답안 #503490

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

int main(){
    int l,r;
    cin >> l >> r;
    bool bl[l];
    vector<int> rows[r];
    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;
            }
        }
    }
    if(bpres){
        cout << maxb-minb+1;
    }
    else{
        cout << 0;
    }
}

Compilation message

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