Submission #998684

# Submission time Handle Problem Language Result Execution time Memory
998684 2024-06-14T14:01:40 Z adkjt Lasers (NOI19_lasers) C++14
24 / 100
259 ms 15976 KB
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define f first
#define s second
int qs[555555];
set<pii> s;
int main()
{
    int l,q;cin>>l>>q;
    while(q--)
    {
        int n;cin>>n;
        for(int i=1;i<=n;i++)
        {
            int x;cin>>x;
            qs[i]=qs[i-1];
            qs[i]+=x;
        }
        int g=l-qs[n],r=l-qs[n]+qs[1];
        if(n==1&&qs[1]>l/2)
        {
            s.insert({l-qs[1]+1,qs[1]});
        }
        for(int i=2;i<=n;i++)
        {
            if(g>=qs[i]-qs[i-1]) continue;
            int L=r+1,R=r+qs[i]-qs[i-1]-g;
            s.insert({L,R});
            //cout<<r<<' '<<L<<' '<<R<<'\n';
            r+=qs[i]-qs[i-1];
        }
    }
    int cnt=0,R=0;
    for(auto it=s.begin();it!=s.end();it++)
    {
        int u=(*it).f,v=(*it).s;
        if(v<R) continue;
        if(u>R)
        cnt+=v-u+1;
        else if(u<R)
            cnt+=v-R;
        R=v;
        //cout<<u<<' '<<v<<'\n';
    }
    cout<<cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 170 ms 5972 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 380 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 259 ms 15976 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 9044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 9044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 170 ms 5972 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 380 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 259 ms 15976 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 53 ms 9044 KB Output isn't correct
22 Halted 0 ms 0 KB -