답안 #1079024

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079024 2024-08-28T09:30:36 Z anton Tiles (BOI24_tiles) C++17
0 / 100
436 ms 1048576 KB
#include<bits/stdc++.h>

using namespace std;
#define int long long
#define pt complex<int>
#define pii pair<int, int>
int N, M;
vector<pt> points; 
signed main(){
    cin>>N>>M;
    int min_y = 1e18, max_y= -1e18;

    vector<pii> col_range(M, {1e18, -1e18});
    for(int i = 0; i<N; i++){
        int a, b;
        cin>>a>>b;
        points.push_back({a, b});
    }

    pt prev= points.back();
    for(int i = 0; i<N; i++){
        pt edge = points[i]-prev;

        if(edge.imag() == 0){
            pii range = {min(points[i].real(), prev.real()), max(points[i].real(), prev.real())};
            for(int i = range.first; i<range.second; i++){
                col_range[i].first = min(col_range[i].first, points[i].imag());
                col_range[i].second = max(col_range[i].second, points[i].imag());
            }
        }
        prev=  points[i];
    }

    int k =-1;
    bool ok = true;
    while(ok && k<=M-3){

        if((col_range[k+1].second-col_range[k+1].first)%2  != 0){
            ok = false;
        }
        if(col_range[k+1] != col_range[k+2]){
            ok = false;
        }
        if(ok){
            k+=2;
        }
    }
    cout<<k+1<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:9: warning: unused variable 'min_y' [-Wunused-variable]
   11 |     int min_y = 1e18, max_y= -1e18;
      |         ^~~~~
Main.cpp:11:23: warning: unused variable 'max_y' [-Wunused-variable]
   11 |     int min_y = 1e18, max_y= -1e18;
      |                       ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 436 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 436 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 387 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 402 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 436 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -