# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
239830 | 2020-06-17T11:06:46 Z | mhy908 | Lasers (NOI19_lasers) | C++14 | 55 ms | 7160 KB |
#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); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 55 ms | 7160 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 512 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 6 ms | 512 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 55 ms | 7160 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |