답안 #503493

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
503493 2022-01-08T07:55:20 Z jpark Lasers (NOI19_lasers) C++14
0 / 100
96 ms 262148 KB
#include<iostream>
#include<vector>
#define ll long long
using namespace std;

int main(){
    ll l,r;
    cin >> l >> r;
    ll 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(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;
    }
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:9:8: warning: variable 'bl' set but not used [-Wunused-but-set-variable]
    9 |     ll bl[l];
      |        ^~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 96 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 96 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 11444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 11444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 96 ms 262148 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -