Task: | Hiitism |
Sender: | (╯°□°)╯︵ ┻━┻ |
Submission time: | 2024-11-16 13:54:56 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.03 s | details |
#7 | ACCEPTED | 0.03 s | details |
#8 | WRONG ANSWER | 0.11 s | details |
#9 | WRONG ANSWER | 0.12 s | details |
#10 | WRONG ANSWER | 0.12 s | details |
#11 | WRONG ANSWER | 0.12 s | details |
#12 | ACCEPTED | 0.06 s | details |
#13 | ACCEPTED | 0.04 s | details |
#14 | ACCEPTED | 0.04 s | details |
#15 | ACCEPTED | 0.03 s | details |
#16 | WRONG ANSWER | 0.07 s | details |
#17 | WRONG ANSWER | 0.07 s | details |
#18 | ACCEPTED | 0.02 s | details |
#19 | ACCEPTED | 0.02 s | details |
#20 | ACCEPTED | 0.06 s | details |
#21 | ACCEPTED | 0.04 s | details |
#22 | ACCEPTED | 0.04 s | details |
#23 | ACCEPTED | 0.04 s | details |
#24 | ACCEPTED | 0.03 s | details |
#25 | ACCEPTED | 0.03 s | details |
#26 | ACCEPTED | 0.04 s | details |
#27 | ACCEPTED | 0.03 s | details |
#28 | ACCEPTED | 0.02 s | details |
#29 | WRONG ANSWER | 0.04 s | details |
#30 | WRONG ANSWER | 0.03 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:35:33: warning: array subscript has type 'char' [-Wchar-subscripts] 35 | rowC[i][a]++; | ^ input/code.cpp:36:33: warning: array subscript has type 'char' [-Wchar-subscripts] 36 | colC[j][a]++; | ^ input/code.cpp:47:45: warning: array subscript has type 'char' [-Wchar-subscripts] 47 | if (rowC[i][c]+rowC[i][0]==m) { | ^ input/code.cpp:48:59: warning: array subscript has type 'char' [-Wchar-subscripts] 48 | int cnt = rowC[i][c]; | ^ input/code.cpp:58:45: warning: array subscript has type 'char' [-Wchar-subscripts] 58 | if (colC[i][c]+colC[i][0]==n) { |...
Code
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int MN = 1024; char cur[MN][MN]; int rowC[MN][256]; int colC[MN][256]; struct R { char type; int index; char color; }; bool isOk(int n, int m) { for(int i=0; i<n; ++i) for(int j=0; j<m; ++j) { char c = cur[i][j]; if (c==0) continue; if (c=='.') continue; return 0; } return 1; } int main() { int n,m; cin>>n>>m; for(int i=0; i<n; ++i) { cin>>cur[i]; for(int j=0; j<m; ++j) { char a = cur[i][j]; rowC[i][a]++; colC[j][a]++; } } vector<R> res; while(!isOk(n,m)) { int brow=0; int bcol=0; int bcnt=0; char bchar=0; for(char c: {'H','I','T'}) { for(int i=0; i<n; ++i) { if (rowC[i][c]+rowC[i][0]==m) { int cnt = rowC[i][c]; if (cnt > bcnt) { bcnt = cnt; brow = i; bcol = -1; bchar = c; } } } for(int i=0; i<m; ++i) { if (colC[i][c]+colC[i][0]==n) { int cnt = colC[i][c]; if (cnt > bcnt) { bcnt = cnt; bcol = i; brow = -1; bchar = c; } } } } if (bchar==0) { cout<<"Impossible\n"; return 0; } if (brow>=0) { for(int i=0; i<m; ++i) { char& c = cur[brow][i]; colC[i][c]--; colC[i][0]++; c = 0; } for(char c: {'H','I','T','.'}) rowC[brow][c]=0; rowC[brow][0] = m; res.push_back({'R', brow+1, bchar}); } else { for(int i=0; i<n; ++i) { char& c = cur[i][bcol]; rowC[i][c]--; rowC[i][0]++; c = 0; } for(char c: {'H','I','T','.'}) colC[bcol][c]=0; colC[bcol][0] = m; res.push_back({'C', bcol+1, bchar}); } } reverse(res.begin(), res.end()); for(R r: res) { cout<<r.type<<' '<<r.index<<' '<<r.color<<'\n'; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
3 3 .H. IHI TTT |
correct output |
---|
3 R 2 I C 2 H R 3 T |
user output |
---|
R 2 I C 2 H R 3 T |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 2 .H IH |
correct output |
---|
2 R 2 I C 2 H |
user output |
---|
R 2 I C 2 H |
Test 3
Verdict: WRONG ANSWER
input |
---|
10 10 T.TIH..... IIIIIIIIII T.TIH..... TIIIHIIIII ... |
correct output |
---|
7 C 3 T R 10 I R 4 I C 5 H ... |
user output |
---|
C 3 T R 10 I R 4 I C 1 T C 4 I ... |
Test 4
Verdict: WRONG ANSWER
input |
---|
100 100 .............H........I.....IT... |
correct output |
---|
19 R 3 T C 44 H R 34 I C 30 T ... |
user output |
---|
R 3 T C 44 H R 34 I C 30 T R 70 T ... |
Test 5
Verdict: ACCEPTED
input |
---|
100 100 .........................H....... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 6
Verdict: ACCEPTED
input |
---|
1000 1000 H.II..T.I.IH..I..H.I..I..ITHH.... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 7
Verdict: ACCEPTED
input |
---|
1000 1000 HHHIHHHHHHHHHHHHIHHHHHHHHHHHHH... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 8
Verdict: WRONG ANSWER
input |
---|
1000 1000 IHIHTI.T.H..IHHIIT.I.TT.HH.HI.... |
correct output |
---|
1552 C 822 I C 83 T C 55 I R 984 H ... |
user output |
---|
C 83 T C 822 I C 55 I R 984 H R 837 H ... |
Test 9
Verdict: WRONG ANSWER
input |
---|
1000 1000 HHHHHHHHHHHHHHHHHHHHHIHHHHHHHH... |
correct output |
---|
1727 R 500 I C 938 H C 804 H R 263 H ... |
user output |
---|
R 500 I C 938 H C 804 H R 952 I R 413 I ... |
Test 10
Verdict: WRONG ANSWER
input |
---|
1000 1000 TITTTHTITTHTHTHITTTTTTTHTHTTTI... |
correct output |
---|
1856 C 22 H R 531 T C 412 H C 288 H ... |
user output |
---|
R 227 H C 63 T C 22 H R 531 T C 412 H ... |
Test 11
Verdict: WRONG ANSWER
input |
---|
1000 1000 IHHTTTTHTIIIHTTTTHTIITTTHHITIT... |
correct output |
---|
1826 R 200 H R 167 I C 445 I C 355 I ... |
user output |
---|
R 200 H C 445 I C 355 I C 303 I R 167 I ... |
Test 12
Verdict: ACCEPTED
input |
---|
1000 1000 TTTTTITTTHTHTITIIHTIITIHTTIHTT... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 13
Verdict: ACCEPTED
input |
---|
1000 1000 TITHITITIITTIIIIIHIIIIHTIIIHTI... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 14
Verdict: ACCEPTED
input |
---|
1000 1000 TTTTTTTTTTTTTTTTTTTITTTTTTTITT... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 15
Verdict: ACCEPTED
input |
---|
1000 1000 IHTHHHIHIIIHHTTHHHHIHIIHHIHHHH... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 16
Verdict: WRONG ANSWER
input |
---|
1000 500 HIHHTHTITTHIHTHTTHIHTTIHTTHHTH... |
correct output |
---|
1417 C 75 I R 430 T C 195 H R 441 I ... |
user output |
---|
C 75 I R 430 T C 201 I C 195 H R 501 T ... |
Test 17
Verdict: WRONG ANSWER
input |
---|
500 1000 IHIIIHIIHIIIIIHIHHIIIIIIIIIIII... |
correct output |
---|
1418 C 971 T C 744 I C 654 I C 540 T ... |
user output |
---|
C 971 T C 540 T C 392 T C 255 T C 197 T ... |
Test 18
Verdict: ACCEPTED
input |
---|
1000 500 IIIIIIIIIIIIIIITIIIIIIITTIIIII... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 19
Verdict: ACCEPTED
input |
---|
500 1000 HIITITHHHHIHHIHHTHIIIHHHHTHTHH... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 20
Verdict: ACCEPTED
input |
---|
1000 1000 TIITIIIIIIIIIIIIIIIIIHIHIIIIII... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 21
Verdict: ACCEPTED
input |
---|
1000 1000 TTHTTTTTHTTTHTTTTTTTTHHTTTTTIT... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 22
Verdict: ACCEPTED
input |
---|
1000 1000 IHIIIIITHIIIHIHHHITHIIIIHTTIHI... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 23
Verdict: ACCEPTED
input |
---|
1000 1000 TTHIHIITHTI.HHIHHITIHIHIHIITIH... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 24
Verdict: ACCEPTED
input |
---|
1000 1000 IHIHIIIIIIIIIHIIIHIHIITIHIIIII... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 25
Verdict: ACCEPTED
input |
---|
1000 500 HIHITTIHITHHHTITHIHHHTHHIHHIII... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 26
Verdict: ACCEPTED
input |
---|
500 1000 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 27
Verdict: ACCEPTED
input |
---|
1000 500 TTTTIHTTTHTTHTITTTTHTHTTHTITTI... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 28
Verdict: ACCEPTED
input |
---|
500 1000 HTIIIHIIIHITIHIIIIIIHTIIIIITHI... |
correct output |
---|
Impossible |
user output |
---|
Impossible |
Test 29
Verdict: WRONG ANSWER
input |
---|
1000 1000 ................................. |
correct output |
---|
0 |
user output |
---|
(empty) |
Test 30
Verdict: WRONG ANSWER
input |
---|
1000 1000 ................................. |
correct output |
---|
1 C 562 T |
user output |
---|
C 562 T |