#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int MAXN = 1e6 + 5;
vector < int > freq ( MAXN, 0);
int n, q;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> q;
while ( q-- ){
int k; cin >> k;
int yes = n;
int a[k + 5];
for ( int i = 1; i <= k; i++){
cin >> a[i];
}
sort ( a + 1, a + 1 + k, greater < int >());
for ( int i = 1; i <= k; i++){
for ( int j = yes - a[i] + 1; j <= a[i]; j++){
freq[j]++;
///cout << j << " ";
}
yes -= a[i];
}
}
int ans = 0;
int l = 1, r = n;
while ( l < r ){
if ( freq[l] ) freq[r] = 1;
l++; r--;
}
for ( int i = 1; i <= n; i++) if ( freq[i] ) ans++;
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
16476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
16476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
10036 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8284 KB |
Output is correct |
2 |
Incorrect |
1 ms |
8284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
21 ms |
10036 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
16476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |