# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1079012 | anton | Tiles (BOI24_tiles) | C++17 | 377 ms | 1048576 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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+1, {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 =0;
bool ok = true;
for(; k<=M && ok; k+=2){
if((col_range[k].second-col_range[k].first)%2 != 0){
ok = false;
}
if(col_range[k] != col_range[k+1]){
ok = false;
}
}
cout<<k<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |