답안 #642250

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
642250 2022-09-19T03:47:12 Z makanhulia Lasers (NOI19_lasers) C++17
65 / 100
148 ms 58924 KB
#include <bits/stdc++.h>
using namespace std;

#define nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define otsumiko exit(0);
#define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > >
#define mikochi priority_queue<long long, vector<long long>, greater<long long> >

long long l, r, x, ao = 1, wd, ans, ca, cl, cr, cs, sl[500069], sx = 0, vd[1000069];
vector<long long> wl[500069], ps[500069];

int main() {
  nyahalo
  long long i, j, ii;
  cin >> l >> r;
  for (i=1; i<=r; i++) {
    cin >> x;
    sx += x;
    cs = 0;
    ps[i].push_back(0);
    for (j=1; j<=x; j++) {
      cin >> wd;
      cs += wd;
      wl[i].push_back(wd);
      ps[i].push_back(cs);
    }
    sl[i] = cs;
    if (x != 1) {
      ao = 0;
    }
  }
  if (ao == 1) {
    ans = 0;
    for (i=1; i<=r; i++) {
      wd = wl[i][0];
      cr = wd;
      cl = l-wd+1;
      ca = max(0ll, cr-cl+1);
      ans = max(ans, ca);
    }
    cout << ans << "\n";
    otsumiko
  }
  if ((r == 2 && l<=1000000) || (l<=1000 && sx<=1000)) {
    ans = 0;
    for (i=1; i<=r; i++) {
      //cout << "sl: " << sl[i] << "\n";
      //ca = 0;
      for (j=1; j<=l; j++) {
        cl = *(lower_bound(ps[i].begin(), ps[i].end(), j)-1);
        cr = sl[i]-cl;
        cr = l+1-cr;
        if (cr<=j) {
          if (vd[j] == 0) {
            ans++;
          }
          vd[j] = 1;
        }
      }
      //cout << "ca: " << ca << "\n";
      //ans = max(ans, ca);
    }
    cout << ans << "\n";
    otsumiko
  }
  cout << "sek\n";
  otsumiko
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:14:19: warning: unused variable 'ii' [-Wunused-variable]
   14 |   long long i, j, ii;
      |                   ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23764 KB Output is correct
3 Correct 11 ms 23824 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 11 ms 23816 KB Output is correct
6 Correct 11 ms 23808 KB Output is correct
7 Correct 11 ms 23764 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 13 ms 23764 KB Output is correct
10 Correct 12 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23764 KB Output is correct
3 Correct 11 ms 23824 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 11 ms 23816 KB Output is correct
6 Correct 11 ms 23808 KB Output is correct
7 Correct 11 ms 23764 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 13 ms 23764 KB Output is correct
10 Correct 12 ms 23764 KB Output is correct
11 Correct 12 ms 23892 KB Output is correct
12 Correct 148 ms 58392 KB Output is correct
13 Correct 12 ms 23792 KB Output is correct
14 Correct 12 ms 23700 KB Output is correct
15 Correct 12 ms 23884 KB Output is correct
16 Correct 11 ms 23764 KB Output is correct
17 Correct 145 ms 58756 KB Output is correct
18 Correct 12 ms 23764 KB Output is correct
19 Correct 12 ms 23720 KB Output is correct
20 Correct 11 ms 23788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 37652 KB Output is correct
2 Correct 53 ms 32384 KB Output is correct
3 Correct 53 ms 33340 KB Output is correct
4 Correct 86 ms 36180 KB Output is correct
5 Correct 64 ms 34208 KB Output is correct
6 Correct 90 ms 37564 KB Output is correct
7 Correct 31 ms 30284 KB Output is correct
8 Correct 93 ms 41224 KB Output is correct
9 Correct 67 ms 33976 KB Output is correct
10 Correct 93 ms 38132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 12 ms 23800 KB Output is correct
3 Correct 13 ms 23716 KB Output is correct
4 Correct 12 ms 23804 KB Output is correct
5 Correct 12 ms 23716 KB Output is correct
6 Correct 14 ms 23824 KB Output is correct
7 Correct 12 ms 23892 KB Output is correct
8 Correct 12 ms 23772 KB Output is correct
9 Correct 12 ms 23892 KB Output is correct
10 Correct 12 ms 23764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 37652 KB Output is correct
2 Correct 53 ms 32384 KB Output is correct
3 Correct 53 ms 33340 KB Output is correct
4 Correct 86 ms 36180 KB Output is correct
5 Correct 64 ms 34208 KB Output is correct
6 Correct 90 ms 37564 KB Output is correct
7 Correct 31 ms 30284 KB Output is correct
8 Correct 93 ms 41224 KB Output is correct
9 Correct 67 ms 33976 KB Output is correct
10 Correct 93 ms 38132 KB Output is correct
11 Correct 12 ms 23764 KB Output is correct
12 Correct 12 ms 23800 KB Output is correct
13 Correct 13 ms 23716 KB Output is correct
14 Correct 12 ms 23804 KB Output is correct
15 Correct 12 ms 23716 KB Output is correct
16 Correct 14 ms 23824 KB Output is correct
17 Correct 12 ms 23892 KB Output is correct
18 Correct 12 ms 23772 KB Output is correct
19 Correct 12 ms 23892 KB Output is correct
20 Correct 12 ms 23764 KB Output is correct
21 Correct 139 ms 58924 KB Output is correct
22 Incorrect 22 ms 26804 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 23764 KB Output is correct
2 Correct 11 ms 23764 KB Output is correct
3 Correct 11 ms 23824 KB Output is correct
4 Correct 10 ms 23764 KB Output is correct
5 Correct 11 ms 23816 KB Output is correct
6 Correct 11 ms 23808 KB Output is correct
7 Correct 11 ms 23764 KB Output is correct
8 Correct 12 ms 23764 KB Output is correct
9 Correct 13 ms 23764 KB Output is correct
10 Correct 12 ms 23764 KB Output is correct
11 Correct 12 ms 23892 KB Output is correct
12 Correct 148 ms 58392 KB Output is correct
13 Correct 12 ms 23792 KB Output is correct
14 Correct 12 ms 23700 KB Output is correct
15 Correct 12 ms 23884 KB Output is correct
16 Correct 11 ms 23764 KB Output is correct
17 Correct 145 ms 58756 KB Output is correct
18 Correct 12 ms 23764 KB Output is correct
19 Correct 12 ms 23720 KB Output is correct
20 Correct 11 ms 23788 KB Output is correct
21 Correct 87 ms 37652 KB Output is correct
22 Correct 53 ms 32384 KB Output is correct
23 Correct 53 ms 33340 KB Output is correct
24 Correct 86 ms 36180 KB Output is correct
25 Correct 64 ms 34208 KB Output is correct
26 Correct 90 ms 37564 KB Output is correct
27 Correct 31 ms 30284 KB Output is correct
28 Correct 93 ms 41224 KB Output is correct
29 Correct 67 ms 33976 KB Output is correct
30 Correct 93 ms 38132 KB Output is correct
31 Correct 12 ms 23764 KB Output is correct
32 Correct 12 ms 23800 KB Output is correct
33 Correct 13 ms 23716 KB Output is correct
34 Correct 12 ms 23804 KB Output is correct
35 Correct 12 ms 23716 KB Output is correct
36 Correct 14 ms 23824 KB Output is correct
37 Correct 12 ms 23892 KB Output is correct
38 Correct 12 ms 23772 KB Output is correct
39 Correct 12 ms 23892 KB Output is correct
40 Correct 12 ms 23764 KB Output is correct
41 Correct 139 ms 58924 KB Output is correct
42 Incorrect 22 ms 26804 KB Output isn't correct
43 Halted 0 ms 0 KB -