# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1079116 |
2024-08-28T10:58:23 Z |
anton |
Tiles (BOI24_tiles) |
C++17 |
|
67 ms |
8620 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pt complex<int>
#define pii pair<int, int>
int N, M;
const int MAX_N = 1001;
vector<pt> points;
char cont[MAX_N][MAX_N];
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 line_id = 0;
for(int j = 0; j<MAX_N; j++){
while(line_id<col_range[i].size() && col_range[i][line_id]<=j){
line_id++;
}
if(line_id%2 == 0){
cont[i][j] = '.';
}
else{
cont[i][j] = '#';
}
//cout<<cont[i][j]<<" ";
}
//cout<<endl;
}
for(int i = 0; i<M; i++){
for(int j = 0; j<MAX_N; j++){
if(cont[i][j]=='#' && cont[i+1][j]=='#' && cont[i][j+1]=='#' && cont[i+1][j+1]=='#'){
cont[i][j] = ',';
cont[i+1][j] = '.';
cont[i][j+1] = ',';
cont[i+1][j+1] = '.';
}
//cout<<cont[i][j]<<" ";
}
//cout<<endl;
}
int k =0;
bool no_left = false;
for(int i = 0; i<M; i++){
bool all_points = true;
for(int j = 0; j<MAX_N; j++){
all_points &= cont[i][j] == '.';
no_left |= cont[i][j] == '#';
}
if(all_points && !no_left){
k = max(k, i+1);
}
}
cout<<k<<endl;
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:40:26: 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 | while(line_id<col_range[i].size() && col_range[i][line_id]<=j){
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1496 KB |
Output is correct |
2 |
Runtime error |
2 ms |
712 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
1500 KB |
Output is correct |
5 |
Correct |
57 ms |
7732 KB |
Output is correct |
6 |
Correct |
67 ms |
8324 KB |
Output is correct |
7 |
Correct |
4 ms |
1372 KB |
Output is correct |
8 |
Correct |
4 ms |
1372 KB |
Output is correct |
9 |
Correct |
5 ms |
1972 KB |
Output is correct |
10 |
Correct |
6 ms |
1752 KB |
Output is correct |
11 |
Correct |
4 ms |
1368 KB |
Output is correct |
12 |
Correct |
4 ms |
1368 KB |
Output is correct |
13 |
Correct |
5 ms |
1932 KB |
Output is correct |
14 |
Correct |
3 ms |
1512 KB |
Output is correct |
15 |
Correct |
4 ms |
1368 KB |
Output is correct |
16 |
Correct |
4 ms |
1372 KB |
Output is correct |
17 |
Correct |
57 ms |
8000 KB |
Output is correct |
18 |
Correct |
60 ms |
7684 KB |
Output is correct |
19 |
Correct |
7 ms |
2004 KB |
Output is correct |
20 |
Correct |
2 ms |
860 KB |
Output is correct |
21 |
Correct |
2 ms |
856 KB |
Output is correct |
22 |
Correct |
3 ms |
860 KB |
Output is correct |
23 |
Correct |
2 ms |
604 KB |
Output is correct |
24 |
Correct |
4 ms |
1368 KB |
Output is correct |
25 |
Correct |
5 ms |
1116 KB |
Output is correct |
26 |
Correct |
1 ms |
604 KB |
Output is correct |
27 |
Correct |
3 ms |
1388 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
444 KB |
Output is correct |
30 |
Correct |
2 ms |
856 KB |
Output is correct |
31 |
Correct |
2 ms |
856 KB |
Output is correct |
32 |
Correct |
2 ms |
1116 KB |
Output is correct |
33 |
Correct |
3 ms |
1372 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
4 ms |
1116 KB |
Output is correct |
37 |
Correct |
3 ms |
1116 KB |
Output is correct |
38 |
Correct |
4 ms |
1372 KB |
Output is correct |
39 |
Correct |
3 ms |
856 KB |
Output is correct |
40 |
Correct |
3 ms |
1368 KB |
Output is correct |
41 |
Correct |
3 ms |
1112 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
1 ms |
348 KB |
Output is correct |
46 |
Correct |
4 ms |
1116 KB |
Output is correct |
47 |
Correct |
2 ms |
604 KB |
Output is correct |
48 |
Correct |
4 ms |
1372 KB |
Output is correct |
49 |
Correct |
58 ms |
7984 KB |
Output is correct |
50 |
Correct |
56 ms |
8620 KB |
Output is correct |
51 |
Correct |
56 ms |
7864 KB |
Output is correct |
52 |
Correct |
60 ms |
8064 KB |
Output is correct |
53 |
Correct |
3 ms |
1112 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
8 ms |
2372 KB |
Output is correct |
56 |
Correct |
6 ms |
2040 KB |
Output is correct |
57 |
Correct |
2 ms |
928 KB |
Output is correct |
58 |
Correct |
0 ms |
348 KB |
Output is correct |
59 |
Correct |
2 ms |
1116 KB |
Output is correct |
60 |
Correct |
0 ms |
344 KB |
Output is correct |
61 |
Correct |
1 ms |
344 KB |
Output is correct |
62 |
Correct |
1 ms |
348 KB |
Output is correct |
63 |
Correct |
6 ms |
1744 KB |
Output is correct |
64 |
Correct |
7 ms |
2264 KB |
Output is correct |
65 |
Correct |
3 ms |
1116 KB |
Output is correct |
66 |
Correct |
4 ms |
1372 KB |
Output is correct |
67 |
Correct |
3 ms |
1512 KB |
Output is correct |
68 |
Correct |
4 ms |
1372 KB |
Output is correct |
69 |
Correct |
4 ms |
1372 KB |
Output is correct |
70 |
Correct |
3 ms |
1372 KB |
Output is correct |
71 |
Correct |
3 ms |
1372 KB |
Output is correct |
72 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |