Submission #503494

# Submission time Handle Problem Language Result Execution time Memory
503494 2022-01-08T07:57:04 Z jpark Lasers (NOI19_lasers) C++14
24 / 100
309 ms 33188 KB
#include<iostream>
#include<vector>
#define ll long long
using namespace std;

int main(){
    ll l,r;
    cin >> l >> r;
    //bool bl[l];
    vector<ll> rows[r+100];
    //for(int i=0; i<l; i++) bl[i] = 0;
    for(int i = 0; i<r; i++){
        int x; cin >> x;
        for(int j=0; j<x; j++){
            int w; cin >> w;
            rows[i].push_back(w);
        }
    }
    int minb = (l+1)/2;
    int maxb = (l+1)/2;
    bool bpres = false;
    for(int i=0; i<r; i++){
        if(rows[i].size()>0){
            if(2*rows[i][0]>l){
                bpres = true;
                int bnum = 2*rows[i][0]-l;
                if(bnum%2==0){
                    int tminb = l/2;
                    tminb -= bnum/2;
                    tminb += 1;
                    minb = min(minb,tminb);
                    int tmaxb = l/2;
                    tmaxb += bnum/2;
                    maxb = max(maxb,tmaxb);
                }
                else{
                    int tminb = (l+1)/2;
                    tminb -= bnum/2;
                    minb = min(minb,tminb);
                    int tmaxb = (l+1)/2;
                    tmaxb += bnum/2;
                    maxb = max(maxb,tmaxb);
                }
            }
        }
        
    }
    if(bpres){
        cout << maxb-minb+1;
    }
    else{
        cout << 0;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 288 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 296 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 288 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 296 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 276 KB Output is correct
12 Correct 309 ms 32872 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 280 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 296 ms 33188 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 288 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 296 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 276 KB Output is correct
12 Correct 309 ms 32872 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 280 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 296 ms 33188 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Incorrect 44 ms 4564 KB Output isn't correct
22 Halted 0 ms 0 KB -