Submission #1155395
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
string S[9];
int dx[8] = { -2, -1, 1, 2 , -2, -1, 1, 2 };
int dy[8] = { 1, 2, 2, 1, -1, -2, -2, -1 };
//-----------------------------------------------------------------
string sol() {
// check A
rep(y, 0, 9) {
set<char> s;
rep(x, 0, 9) s.insert(S[y][x]);
if (s.size() != 9) return "No";
}
// check B
rep(x, 0, 9) {
set<char> s;
rep(y, 0, 9) s.insert(S[y][x]);
if (s.size() != 9) return "No";
}
// check C
rep(y, 0, 9) rep(x, 0, 9) {
rep(i, 0, 8) {
int xx = x + dx[i];
int yy = y + dy[i];
if (xx < 0 || 9 <= xx) continue;
if (yy < 0 || 9 <= yy) continue;
if (S[y][x] == S[yy][xx]) return "No";
}
}
return "Yes";
}
//-----------------------------------------------------------------
int main() {
rep(y, 0, 9) cin >> S[y];
cout << sol() << endl;
}
Submission Info
Submission Time |
|
Task |
B - 数字パズル |
User |
hamayanhamayan |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
929 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
100 / 100 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt, sample_03.txt |
All |
sample_01.txt, sample_02.txt, sample_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name |
Status |
Exec Time |
Memory |
01.txt |
AC |
1 ms |
256 KB |
02.txt |
AC |
1 ms |
256 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
AC |
1 ms |
256 KB |
05.txt |
AC |
1 ms |
256 KB |
06.txt |
AC |
1 ms |
256 KB |
07.txt |
AC |
1 ms |
256 KB |
08.txt |
AC |
1 ms |
256 KB |
09.txt |
AC |
1 ms |
256 KB |
10.txt |
AC |
1 ms |
256 KB |
11.txt |
AC |
1 ms |
256 KB |
12.txt |
AC |
1 ms |
256 KB |
13.txt |
AC |
1 ms |
256 KB |
14.txt |
AC |
1 ms |
256 KB |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
sample_03.txt |
AC |
1 ms |
256 KB |