# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
26332 |
2017-06-29T08:38:24 Z |
김동현(#1101) |
Trapezi (COI17_trapezi) |
C++14 |
|
0 ms |
2020 KB |
#include <bits/stdc++.h>
using namespace std;
int n, c[11][22], bd[11];
char b[11][22];
void f(int x, int y);
void g(int x, int y, int x1, int y1, int x2, int y2, int nxt, int col){
if(y1 <= 0 || y2 <= 0) return;
if(b[x1][y1] == '0' && b[x2][y2] == '0'){
c[x][y] = c[x1][y1] = c[x2][y2] = col;
b[x1][y1] = b[x2][y2] = '.';
f(x, y + nxt);
c[x][y] = c[x1][y1] = c[x2][y2] = 0;
b[x1][y1] = b[x2][y2] = '0';
}
}
void f(int x, int y){
if(x > 2 * n){
for(int i = 1; i <= 2 * n; i++){
for(int j = max(1, 2 * (i - n)); j < bd[i]; j++){
putchar(c[i][j] ? c[i][j] + '0' : '.');
}
puts("");
}
exit(0);
}
if(y == bd[x]){ f(x + 1, 1); return; }
if(b[x][y] != '0'){ f(x, y + 1); return; }
int q = x % 2 * 2, w = (y + 1) / 2 % 2;
if(y % 2){
g(x, y, x, y + 1, x, y + 2, 3, (q + 3) ^ w);
g(x, y, x, y + 1, x + 1, y + 1, 2, (q + 3) ^ w);
g(x, y, x + 1, y, x + 1, y + 1, 1, (q + 2) ^ w);
g(x, y, x + 1, y + 1, x + 1, y + 2, 1, (q + 3) ^ w);
}
else{
g(x, y, x, y + 1, x, y + 2, 3, (q + 1) ^ w);
g(x, y, x, y + 1, x + 1, y + 2, 2, (q + 3) ^ w);
}
}
int main(){
scanf("%d", &n);
for(int i = 1; i <= 2 * n; i++){
scanf("%s", b[i] + max(1, 2 * (i - n)));
for(bd[i] = max(1, 2 * (i - n)); b[i][bd[i]]; bd[i]++);
}
f(1, 1);
puts("nemoguce");
}
Compilation message
trapezi.cpp: In function 'int main()':
trapezi.cpp:46:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
trapezi.cpp:48:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%s", b[i] + max(1, 2 * (i - n)));
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |