Submission #1079090

#TimeUsernameProblemLanguageResultExecution timeMemory
1079090antonTiles (BOI24_tiles)C++17
0 / 100
53 ms6792 KiB
#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; vector<vector<int>> col_range(M); 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 j = range.first; j<range.second; j++){ col_range[j].push_back(points[i].imag()); } } prev= points[i]; } for(int i = 0; i<M; i++){ sort(col_range[i].begin(), col_range[i].end()); } int k =-1; bool ok = true; while(ok && k<=M-3){ for(int i = 0; i<col_range[k+1].size(); i+=2){ if((col_range[k+1][i+1]-col_range[k+1][i])%2 != 0){ ok = false; } } if(col_range[k+1].size() != col_range[k+2].size()){ ok = false; } else{ for(int i = 0; i<col_range[k+1].size(); i++){ if(col_range[k+1][i] != col_range[k+2][i]){ ok = false; } } } if(ok){ k+=2; } } cout<<k+1<<endl; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:40:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int i = 0; i<col_range[k+1].size(); i+=2){
      |                        ~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:49:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |             for(int i = 0; i<col_range[k+1].size(); i++){
      |                            ~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...