Submission #998718

# Submission time Handle Problem Language Result Execution time Memory
998718 2024-06-14T14:58:56 Z adkjt Lasers (NOI19_lasers) C++14
24 / 100
265 ms 10324 KB
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define f first
#define s second
int qs[555555],a[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]) {
                r=qs[i]+g;
                continue;
            }
            int sp=qs[i]+g-qs[i-1];
            int L=sp-(qs[i]-qs[i-1]);
            int R=qs[i]-qs[i-1]-1;
            L+=r;
            R+=r;
            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 0 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 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 164 ms 424 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 265 ms 10056 KB Output is correct
18 Correct 1 ms 344 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 51 ms 10324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 10324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 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 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 164 ms 424 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 265 ms 10056 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 51 ms 10324 KB Output isn't correct
22 Halted 0 ms 0 KB -