Submission #227602

# Submission time Handle Problem Language Result Execution time Memory
227602 2020-04-28T04:25:12 Z Autoratch Lasers (NOI19_lasers) C++14
10 / 100
40 ms 3832 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 5e5 + 1;

int m,n;
vector<pair<int,int> > a;
int tmp[N];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> m >> n;
    for(int i = 1;i <= n;i++)
    {
        int am,sum = 0;
        cin >> am;
        for(int j = 0;j < am;j++){ int x; cin >> x; sum+=x; tmp[j] = x; }
        int ll = 0,rr = sum;
        for(int j = 0;j < am;j++)
        {
            rr-=tmp[j];
            int l = ll+tmp[j],r = m-rr-tmp[j]+1;
            if(r<=l) a.push_back({r,l});
            ll+=tmp[j];
        }
    }
    sort(a.begin(),a.end());
    int now = 0,ans = 0;
    for(auto [x,y] : a) 
    {
        if(now<x) now = y,ans+=y-x+1;
        else ans+=y-now,now = y;
    }
    cout << ans;
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:31:14: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
     for(auto [x,y] : a) 
              ^
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Incorrect 5 ms 384 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Incorrect 5 ms 384 KB Output isn't correct
12 Halted 0 ms 0 KB -