# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239827 | 2020-06-17T11:02:43 Z | mhy908 | Lasers (NOI19_lasers) | C++14 | 1000 ms | 3576 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]+=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)-fen.sum(i-1))ans++; } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 47 ms | 3576 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1078 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 47 ms | 3576 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |