QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#397179 | #8113. Sudoku | lfxxx# | 50 ✓ | 0ms | 3824kb | C++14 | 1.5kb | 2024-04-23 19:07:06 | 2024-07-04 03:36:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 12;
int a[N][N];
bool vis[N];
bool en;
int main()
{
#ifdef IAKIOI
freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
cerr << (&be - &en) / 1024.0 / 1024 << '\n' << "-------------------\n";
#endif
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
scanf("+---+---+---+\n");
for (int i = 1; i <= 9; ++i) {
scanf("|");
for (int j = 1; j <= 9; ++j) {
char c;
cin >> c;
if (isdigit(c)) a[i][j] = c - '0';
if (j % 3 == 0) scanf("|");
}
scanf("\n");
if (i % 3 == 0) scanf("+---+---+---+\n");
}
for (int i = 1; i <= 9; ++i) {
memset(vis, 0, sizeof vis);
for (int j = 1; j <= 9; ++j) {
if (!a[i][j]) continue;
if (vis[a[i][j]]) {
cout << "GRESKA\n";
return 0;
}
vis[a[i][j]] = 1;
}
}
for (int i = 1; i <= 9; ++i) {
memset(vis, 0, sizeof vis);
for (int j = 1; j <= 9; ++j) {
if (!a[j][i]) continue;
if (vis[a[j][i]]) {
cout << "GRESKA\n";
return 0;
}
vis[a[j][i]] = 1;
}
}
for (int i : {1, 4, 7}) {
for (int j : {1, 4, 7}) {
memset(vis, 0, sizeof vis);
for (int k : {0, 1, 2}) {
for (int l : {0, 1, 2}) {
if (!a[i + k][j + l]) continue;
if (vis[a[i + k][j + l]]) {
cout << "GRESKA\n";
return 0;
}
vis[a[i + k][j + l]] = 1;
}
}
}
}
cout << "OK\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3672kb
input:
+---+---+---+ |...|4..|...| |..9|6..|.9.| |...|...|...| +---+---+---+ |3..|..3|54.| |642|8..|...| |...|.1.|6.2| +---+---+---+ |15.|.8.|1.4| |...|...|.3.| |.9.|...|...| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
+---+---+---+ |8.6|.2.|.9.| |3.5|3..|...| |7.9|.6.|...| +---+---+---+ |...|2..|21.| |2..|...|...| |...|4..|..5| +---+---+---+ |...|...|...| |...|...|.3.| |...|..9|..7| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
+---+---+---+ |...|...|...| |.94|8..|.6.| |...|..4|...| +---+---+---+ |73.|7..|.9.| |...|...|8..| |6.5|9..|...| +---+---+---+ |.7.|..3|5..| |...|.48|.76| |.68|...|...| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
+---+---+---+ |...|6..|5.3| |.5.|...|91.| |7..|...|..6| +---+---+---+ |.8.|5..|7..| |...|...|2..| |9.2|...|.38| +---+---+---+ |2..|.1.|.5.| |..8|.68|.89| |...|42.|...| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
+---+---+---+ |...|...|...| |...|...|.94| |8..|...|6..| +---+---+---+ |.4.|...|...| |...|.9.|3.5| |.12|..3|4..| +---+---+---+ |.7.|...|...| |...|24.|...| |1..|8..|..6| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
+---+---+---+ |78.|...|...| |...|..6|..8| |.53|...|...| +---+---+---+ |34.|..7|...| |..2|...|...| |571|2..|...| +---+---+---+ |...|.6.|492| |.2.|.5.|3..| |...|.7.|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
+---+---+---+ |.3.|.87|1.2| |...|.2.|..5| |...|.3.|...| +---+---+---+ |...|..8|.3.| |.56|..3|...| |...|.9.|...| +---+---+---+ |.7.|..4|...| |5..|...|..7| |6..|...|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
+---+---+---+ |...|...|...| |9..|.3.|...| |...|...|.4.| +---+---+---+ |...|.28|...| |.4.|...|...| |.8.|...|...| +---+---+---+ |..3|...|.7.| |...|.1.|...| |.6.|.7.|..4| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Subtask #2:
score: 12
Accepted
Test #9:
score: 12
Accepted
time: 0ms
memory: 3684kb
input:
+---+---+---+ |.93|...|.6.| |.8.|...|.7.| |1..|354|..8| +---+---+---+ |...|.53|...| |.17|...|.6.| |6.8|2..|5..| +---+---+---+ |698|.1.|.2.| |...|.4.|9.1| |4..|.6.|.8.| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
+---+---+---+ |..6|15.|..2| |...|49.|.6.| |53.|8..|...| +---+---+---+ |..5|...|..3| |...|...|..4| |..7|8.1|.9.| +---+---+---+ |...|...|...| |1.7|.9.|...| |.4.|1.7|..5| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
+---+---+---+ |..7|...|.28| |..1|...|..3| |.4.|.9.|..6| +---+---+---+ |.84|...|...| |.76|..3|..8| |...|...|..4| +---+---+---+ |..3|42.|85.| |.5.|..3|.46| |.1.|...|...| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
+---+---+---+ |..8|3..|2..| |9.2|...|...| |.4.|2..|.6.| +---+---+---+ |.9.|...|.1.| |6.3|...|..7| |...|.1.|.8.| +---+---+---+ |...|...|78.| |.7.|6..|..2| |..3|7..|9..| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
+---+---+---+ |...|.84|...| |.27|.1.|...| |...|2..|4..| +---+---+---+ |...|...|7.2| |...|..6|..3| |.1.|..3|...| +---+---+---+ |5..|7..|...| |.8.|...|...| |.4.|6..|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
+---+---+---+ |.3.|5..|...| |..6|.1.|...| |...|.4.|...| +---+---+---+ |..3|..2|...| |.6.|.5.|.9.| |..2|...|3.8| +---+---+---+ |...|..5|8.9| |8..|...|...| |...|...|.6.| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
+---+---+---+ |...|6.8|...| |...|...|9..| |...|..7|...| +---+---+---+ |.72|.8.|3..| |...|...|..5| |9.6|..3|1..| +---+---+---+ |...|5..|.9.| |...|...|.34| |..7|...|..2| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
+---+---+---+ |8..|...|.5.| |...|...|.4.| |9..|1.7|..2| +---+---+---+ |.3.|5..|...| |75.|.3.|...| |2..|.1.|...| +---+---+---+ |..4|...|...| |...|..5|.8.| |...|...|.64| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Subtask #3:
score: 13
Accepted
Test #17:
score: 13
Accepted
time: 0ms
memory: 3688kb
input:
+---+---+---+ |132|.9.|67.| |...|.3.|...| |.1.|.29|4..| +---+---+---+ |.2.|9.8|..4| |4.8|1.6|7..| |6..|...|...| +---+---+---+ |...|.1.|...| |2..|...|...| |..5|.7.|24.| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
+---+---+---+ |537|...|...| |.28|.5.|.91| |..4|...|...| +---+---+---+ |...|.12|...| |...|..5|...| |4.1|...|..5| +---+---+---+ |.9.|.6.|.5.| |...|..9|.3.| |..9|74.|..8| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
+---+---+---+ |7..|.2.|.5.| |.6.|.3.|4..| |..9|..8|..6| +---+---+---+ |...|...|.9.| |...|...|..8| |938|7..|5.4| +---+---+---+ |.5.|...|8..| |.13|...|.8.| |1..|8..|.4.| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
+---+---+---+ |.47|8..|.9.| |6..|...|...| |5..|31.|..4| +---+---+---+ |8..|..4|..9| |16.|...|9.2| |...|7.9|..1| +---+---+---+ |3..|69.|.8.| |7..|.4.|...| |.82|4..|5..| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
+---+---+---+ |...|..5|7..| |.8.|.4.|.5.| |...|...|.21| +---+---+---+ |...|...|...| |43.|...|...| |...|..6|..4| +---+---+---+ |8..|.1.|..6| |..4|...|3.8| |5.7|8..|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
+---+---+---+ |2..|...|...| |...|...|.5.| |...|7..|...| +---+---+---+ |...|...|.8.| |..1|..7|...| |...|8.3|.1.| +---+---+---+ |.1.|4..|.6.| |...|...|..7| |.4.|...|..1| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
+---+---+---+ |..7|...|.64| |.89|...|..3| |...|...|...| +---+---+---+ |...|...|...| |..5|3..|7..| |...|...|...| +---+---+---+ |...|...|...| |...|...|...| |..8|1.9|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
+---+---+---+ |...|..5|...| |1.7|...|...| |...|...|.5.| +---+---+---+ |...|.8.|.4.| |.4.|...|...| |...|..2|36.| +---+---+---+ |...|1.7|..2| |...|269|...| |...|...|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Subtask #4:
score: 14
Accepted
Test #25:
score: 14
Accepted
time: 0ms
memory: 3672kb
input:
+---+---+---+ |.1.|...|2..| |5..|9.9|3.8| |.8.|.5.|..7| +---+---+---+ |625|685|6.3| |...|3.4|..6| |8.9|..6|5..| +---+---+---+ |...|32.|...| |5.3|.2.|.1.| |8.9|2..|8.9| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
+---+---+---+ |48.|...|872| |8..|1..|81.| |54.|2.5|2.7| +---+---+---+ |993|...|812| |66.|...|...| |..6|...|..1| +---+---+---+ |25.|..3|5..| |287|...|.5.| |...|.5.|4..| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
+---+---+---+ |9.6|1..|..4| |29.|.9.|34.| |5..|729|9..| +---+---+---+ |.12|.4.|..3| |6..|152|444| |..5|..8|..2| +---+---+---+ |.9.|..7|28.| |..5|121|..8| |..8|..5|...| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
+---+---+---+ |6..|463|.81| |..4|79.|42.| |551|1.7|...| +---+---+---+ |7.7|2.9|9.1| |7..|.5.|.9.| |..4|.6.|.4.| +---+---+---+ |..9|313|.3.| |6.6|679|8..| |9..|2..|..5| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
+---+---+---+ |...|...|.7.| |...|...|..8| |...|548|...| +---+---+---+ |...|..7|.93| |5..|8..|...| |..9|...|..4| +---+---+---+ |6.3|.5.|..2| |82.|1..|...| |..4|.6.|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
+---+---+---+ |2..|...|..8| |...|.5.|2..| |...|...|...| +---+---+---+ |.2.|..3|...| |.4.|..5|...| |.9.|...|...| +---+---+---+ |...|...|..2| |...|...|..7| |.54|.1.|...| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
+---+---+---+ |...|1..|5..| |...|...|.3.| |...|3..|...| +---+---+---+ |..9|.1.|3.8| |...|27.|...| |...|.6.|.1.| +---+---+---+ |..6|9..|.8.| |.97|...|..6| |8..|...|..3| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
+---+---+---+ |...|5..|6..| |.3.|7..|5..| |...|...|...| +---+---+---+ |...|4..|...| |...|.9.|..6| |.6.|.1.|...| +---+---+---+ |..5|...|...| |3..|...|...| |...|...|.2.| +---+---+---+
output:
OK
result:
ok single line: 'OK'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
+---+---+---+ |..1|...|...| |...|7..|.5.| |.2.|.4.|.1.| +---+---+---+ |8.2|...|1..| |..7|.1.|.8.| |6..|.3.|..3| +---+---+---+ |546|2..|..6| |..9|..9|..8| |...|...|3..| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
+---+---+---+ |95.|...|..3| |.36|.1.|..2| |..1|7.3|5.9| +---+---+---+ |..9|...|2.6| |...|..3|.9.| |..4|...|.5.| +---+---+---+ |...|...|3..| |...|.92|.6.| |2.8|..4|91.| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
+---+---+---+ |...|1.6|..4| |...|...|.13| |7..|..5|1..| +---+---+---+ |..2|4..|..5| |.5.|...|...| |..9|7..|...| +---+---+---+ |...|25.|...| |..3|.18|...| |8..|...|2.1| +---+---+---+
output:
GRESKA
result:
ok single line: 'GRESKA'
Extra Test:
score: 0
Extra Test Passed