답안 #321936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
321936 2020-11-13T14:07:28 Z techiehere08 Lasers (NOI19_lasers) C++14
87 / 100
477 ms 31980 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
  int l, r;
  cin >> l >> r;
  if(l > (int)1e6){
    int ans = 0, max = 0;
    for(int i = 0; i < r; i++){
      int n; cin >> n;
      int x, sum = 0;
      while(n--){
        cin >> x;
        sum += x;
      }
      if(max < sum) max = sum;
    }
    ans = 2 * max - l;
    if(ans < 0) ans = 0;
    cout << ans << endl;
    return 0;
  }
  int ans = 0;
  vector < vector < int >> v(r);
  for(int i = 0; i < r; i++){
    int n; cin >> n;
    v[i].push_back(0);
    while(n--){
      int x; cin >> x;
      x += v[i].back();
      v[i].push_back(x);
    }
  }
  for(int i = 1; i <= l; i++){
    bool ok = true;
    for(int j = 0; j < r; j++){
      int sum1 = 0, sum2 = 0;
      int idx = lower_bound(v[j].begin(), v[j].end(), i) - v[j].begin();
      idx--;
      sum2 = v[j].back() - v[j][idx];
      if(l - i < sum2){
        ok = false;
      }
      if(!ok) {
        //cout << "break for " << i << " " << j << endl;
        break;
      }
    }
    if(ok) ans++;
  }
  cout << l - ans << endl;
  return 0;
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:38:11: warning: unused variable 'sum1' [-Wunused-variable]
   38 |       int sum1 = 0, sum2 = 0;
      |           ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 296 ms 6380 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 308 ms 6272 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 2528 KB Output is correct
2 Correct 79 ms 876 KB Output is correct
3 Correct 86 ms 1128 KB Output is correct
4 Correct 148 ms 2664 KB Output is correct
5 Correct 56 ms 1864 KB Output is correct
6 Correct 161 ms 3296 KB Output is correct
7 Correct 23 ms 364 KB Output is correct
8 Correct 170 ms 4328 KB Output is correct
9 Correct 72 ms 1636 KB Output is correct
10 Correct 128 ms 3112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 512 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 2 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 122 ms 2528 KB Output is correct
2 Correct 79 ms 876 KB Output is correct
3 Correct 86 ms 1128 KB Output is correct
4 Correct 148 ms 2664 KB Output is correct
5 Correct 56 ms 1864 KB Output is correct
6 Correct 161 ms 3296 KB Output is correct
7 Correct 23 ms 364 KB Output is correct
8 Correct 170 ms 4328 KB Output is correct
9 Correct 72 ms 1636 KB Output is correct
10 Correct 128 ms 3112 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 512 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 2 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 2 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 477 ms 31980 KB Output is correct
22 Correct 95 ms 1644 KB Output is correct
23 Correct 74 ms 1132 KB Output is correct
24 Correct 201 ms 3684 KB Output is correct
25 Correct 430 ms 31888 KB Output is correct
26 Correct 88 ms 3308 KB Output is correct
27 Correct 60 ms 1516 KB Output is correct
28 Correct 389 ms 31684 KB Output is correct
29 Correct 391 ms 31924 KB Output is correct
30 Correct 156 ms 2920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 2 ms 364 KB Output is correct
12 Correct 296 ms 6380 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 308 ms 6272 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 122 ms 2528 KB Output is correct
22 Correct 79 ms 876 KB Output is correct
23 Correct 86 ms 1128 KB Output is correct
24 Correct 148 ms 2664 KB Output is correct
25 Correct 56 ms 1864 KB Output is correct
26 Correct 161 ms 3296 KB Output is correct
27 Correct 23 ms 364 KB Output is correct
28 Correct 170 ms 4328 KB Output is correct
29 Correct 72 ms 1636 KB Output is correct
30 Correct 128 ms 3112 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 316 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 512 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 2 ms 364 KB Output is correct
38 Correct 2 ms 364 KB Output is correct
39 Correct 2 ms 364 KB Output is correct
40 Correct 1 ms 364 KB Output is correct
41 Correct 477 ms 31980 KB Output is correct
42 Correct 95 ms 1644 KB Output is correct
43 Correct 74 ms 1132 KB Output is correct
44 Correct 201 ms 3684 KB Output is correct
45 Correct 430 ms 31888 KB Output is correct
46 Correct 88 ms 3308 KB Output is correct
47 Correct 60 ms 1516 KB Output is correct
48 Correct 389 ms 31684 KB Output is correct
49 Correct 391 ms 31924 KB Output is correct
50 Correct 156 ms 2920 KB Output is correct
51 Incorrect 35 ms 1004 KB Output isn't correct
52 Halted 0 ms 0 KB -