제출 #239830

#제출 시각아이디문제언어결과실행 시간메모리
239830mhy908Lasers (NOI19_lasers)C++14
21 / 100
55 ms7160 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define eb emplace_back using namespace std; typedef long long LL; int n, q; struct FENWICK{ int tree[500010]; int sum(int i){ int ans=0; while(i){ ans+=tree[i]; i-=(i&-i); } return ans; } void update(int i, int num){ while(i<=500000){ tree[i]+=num; i+=(i&-i); } } }fen; int arr[500010], sum[500010], ans; int main(){ scanf("%d %d", &n, &q); for(int i=1; i<=q; i++){ int sz; scanf("%d", &sz); for(int j=1; j<=sz; j++){ scanf("%d", &arr[j]); sum[j]=sum[j-1]+arr[j]; } for(int j=1; j<=sz; j++){ int e=sum[j], s=n-(sum[sz]-sum[j-1])+1; if(s<=e){ fen.update(s, 1); fen.update(e+1, -1); } } } for(int i=1; i<=n; i++){ if(fen.sum(i))ans++; } printf("%d", ans); }

컴파일 시 표준 에러 (stderr) 메시지

lasers.cpp: In function 'int main()':
lasers.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &q);
     ~~~~~^~~~~~~~~~~~~~~~~
lasers.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &sz);
         ~~~~~^~~~~~~~~~~
lasers.cpp:33:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &arr[j]);
             ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...