답안 #800372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
800372 2023-08-01T13:50:38 Z 12345678 Lasers (NOI19_lasers) C++17
100 / 100
102 ms 13852 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=5e5+5;
int l, r, qs[nx], x, c, p, ans;
vector<pair<int, int>> v;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>l>>r;
    for (int i=0; i<r; i++)
    {
        cin>>x;
        for (int i=1; i<=x; i++) cin>>qs[i], qs[i]+=qs[i-1];
        for (int i=0; i<x; i++)
        {
            int cl=qs[i], cr=qs[x]-qs[i];
            if (qs[i+1]<l-cr) continue;
            v.push_back({qs[i+1]+1, -1});
            v.push_back({l-cr, 1});
        }
    }
    sort(v.begin(), v.end());
    for (auto [a, b]:v)
    {
        //cout<<a<<' '<<b<<'\n';
        if (c==0) p=a;
        else if (c+b==0) ans+=(a-p-1);
        c+=b;
    }
    cout<<ans;
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:19:17: warning: unused variable 'cl' [-Wunused-variable]
   19 |             int cl=qs[i], cr=qs[x]-qs[i];
      |                 ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 0 ms 328 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 0 ms 328 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 81 ms 13852 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 324 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 94 ms 9416 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 5772 KB Output is correct
2 Correct 6 ms 1368 KB Output is correct
3 Correct 7 ms 1112 KB Output is correct
4 Correct 53 ms 5888 KB Output is correct
5 Correct 18 ms 3376 KB Output is correct
6 Correct 25 ms 3532 KB Output is correct
7 Correct 1 ms 472 KB Output is correct
8 Correct 27 ms 4428 KB Output is correct
9 Correct 23 ms 5324 KB Output is correct
10 Correct 45 ms 10056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 5772 KB Output is correct
2 Correct 6 ms 1368 KB Output is correct
3 Correct 7 ms 1112 KB Output is correct
4 Correct 53 ms 5888 KB Output is correct
5 Correct 18 ms 3376 KB Output is correct
6 Correct 25 ms 3532 KB Output is correct
7 Correct 1 ms 472 KB Output is correct
8 Correct 27 ms 4428 KB Output is correct
9 Correct 23 ms 5324 KB Output is correct
10 Correct 45 ms 10056 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 328 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 98 ms 8612 KB Output is correct
22 Correct 17 ms 2004 KB Output is correct
23 Correct 10 ms 1872 KB Output is correct
24 Correct 42 ms 5964 KB Output is correct
25 Correct 92 ms 8512 KB Output is correct
26 Correct 35 ms 5672 KB Output is correct
27 Correct 14 ms 2004 KB Output is correct
28 Correct 94 ms 8616 KB Output is correct
29 Correct 97 ms 8544 KB Output is correct
30 Correct 29 ms 3628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 0 ms 328 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 81 ms 13852 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 324 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 94 ms 9416 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 39 ms 5772 KB Output is correct
22 Correct 6 ms 1368 KB Output is correct
23 Correct 7 ms 1112 KB Output is correct
24 Correct 53 ms 5888 KB Output is correct
25 Correct 18 ms 3376 KB Output is correct
26 Correct 25 ms 3532 KB Output is correct
27 Correct 1 ms 472 KB Output is correct
28 Correct 27 ms 4428 KB Output is correct
29 Correct 23 ms 5324 KB Output is correct
30 Correct 45 ms 10056 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 328 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 98 ms 8612 KB Output is correct
42 Correct 17 ms 2004 KB Output is correct
43 Correct 10 ms 1872 KB Output is correct
44 Correct 42 ms 5964 KB Output is correct
45 Correct 92 ms 8512 KB Output is correct
46 Correct 35 ms 5672 KB Output is correct
47 Correct 14 ms 2004 KB Output is correct
48 Correct 94 ms 8616 KB Output is correct
49 Correct 97 ms 8544 KB Output is correct
50 Correct 29 ms 3628 KB Output is correct
51 Correct 14 ms 2224 KB Output is correct
52 Correct 97 ms 9812 KB Output is correct
53 Correct 98 ms 9616 KB Output is correct
54 Correct 25 ms 3836 KB Output is correct
55 Correct 61 ms 6944 KB Output is correct
56 Correct 35 ms 6256 KB Output is correct
57 Correct 41 ms 6500 KB Output is correct
58 Correct 102 ms 9860 KB Output is correct
59 Correct 30 ms 3536 KB Output is correct
60 Correct 39 ms 4728 KB Output is correct