답안 #796371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
796371 2023-07-28T10:30:06 Z 12345678 Lasers (NOI19_lasers) C++17
41 / 100
1000 ms 6364 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=5e5+5, mx=1e6+5;
int n, l, x, s[nx], ans;
bool c[mx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>l>>n;
    for (int i=0; i<n; i++)
    {
        cin>>s[i];
        vector<int> v(s[i]+2);
        for (int j=1; j<=s[i]; j++) cin>>v[j], v[j]+=v[j-1];
        v[s[i]+1]=INT_MAX;
        if (v[s[i]]>(l/2))
        {
            for (int j=1; j<=v[s[i]]; j++)
            {
                auto x=*prev(lower_bound(v.begin()+1, v.end(), j));
                if ((v[s[i]]-x)>l-j) c[j]=1;
            }
        }
    }
    for (int i=1; i<=mx; i++) if (c[i]) ans++;
    cout<<ans;
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:28:38: warning: iteration 1000004 invokes undefined behavior [-Waggressive-loop-optimizations]
   28 |     for (int i=1; i<=mx; i++) if (c[i]) ans++;
      |                                   ~~~^
lasers.cpp:28:20: note: within this loop
   28 |     for (int i=1; i<=mx; i++) if (c[i]) ans++;
      |                   ~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 9 ms 6364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 9 ms 6364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 1764 KB Output is correct
2 Correct 39 ms 1408 KB Output is correct
3 Correct 44 ms 1416 KB Output is correct
4 Correct 73 ms 1876 KB Output is correct
5 Correct 53 ms 1876 KB Output is correct
6 Correct 72 ms 2488 KB Output is correct
7 Correct 19 ms 1104 KB Output is correct
8 Correct 82 ms 2144 KB Output is correct
9 Correct 54 ms 1564 KB Output is correct
10 Correct 81 ms 1952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 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 1 ms 340 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 1764 KB Output is correct
2 Correct 39 ms 1408 KB Output is correct
3 Correct 44 ms 1416 KB Output is correct
4 Correct 73 ms 1876 KB Output is correct
5 Correct 53 ms 1876 KB Output is correct
6 Correct 72 ms 2488 KB Output is correct
7 Correct 19 ms 1104 KB Output is correct
8 Correct 82 ms 2144 KB Output is correct
9 Correct 54 ms 1564 KB Output is correct
10 Correct 81 ms 1952 KB Output is correct
11 Correct 1 ms 212 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 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 2 ms 212 KB Output is correct
18 Correct 3 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Execution timed out 1076 ms 1172 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 9 ms 6364 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -