Submission #59403673
Source Code Expand
///In the name of ALLAH, The Most Gracious and The Most Merciful
///Praise be to ALLAH
#include<bits/stdc++.h>
using namespace std;
const int sz = 9;
int ar[sz][sz];
using ll = long long;
#define el "\n"
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testCase int __; cin >> __; while(__--)
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
int forEachBlock(int x, int y)
{
int sum = 0, l, m, o, p;
if(x == 0 && y == 0)
{
l = 0, m = 3;
o = 0, p = 3;
}
if(x == 0 && y == 3)
{
l = 0, m = 3;
o = 3, p = 6;
}
if(x == 0 && y == 6)
{
l = 0, m = 3;
o = 6, p = 9;
}
if(x == 3 && y == 0)
{
l = 3, m = 6;
o = 0, p = 3;
}
if(x == 3 && y == 3)
{
l = 3, m = 6;
o = 3, p = 6;
}
if(x == 3 && y == 6)
{
l = 3, m = 6;
o = 6, p = 9;
}
if(x == 6 && y == 0)
{
l = 6, m = 9;
o = 0, p = 3;
}
if(x == 6 && y == 3)
{
l = 6, m = 9;
o = 3, p = 6;
}
if(x == 6 && y == 6)
{
l = 6, m = 9;
o = 6, p = 9;
}
for(int i = l; i < m; i++)
{
for(int j = o; j < p; j++)
{
sum += ar[i][j];
}
}
if(sum == 45) return 1;
else return 0;
}
void solve()
{
for(int i = 0; i < 9; i++)
{
for(int j = 0; j < 9; j++)
{
cin >> ar[i][j];
}
}
int sum = 0, f = 0;
for(int i = 0; i < 9; i++)
{
sum = 0;
for(int j = 0; j < 9; j++)
{
sum += ar[i][j];
}
if(sum != 45)
{
f = 1;
break;
}
}
if(!f)
{
for(int i = 0; i < 9; i++)
{
sum = 0;
for(int j = 0; j < 9; j++)
{
sum += ar[j][i];
}
if(sum != 45)
{
f = 1;
break;
}
}
}
if(!f)
{
if(forEachBlock(0, 0) == 1)
{
if(forEachBlock(0, 3) == 1)
{
if(forEachBlock(0, 6) == 1)
{
if(forEachBlock(3, 0) == 1)
{
if(forEachBlock(3, 3) == 1)
{
if(forEachBlock(3, 6) == 1)
{
if(forEachBlock(6, 0) == 1)
{
if(forEachBlock(6, 3) == 1)
{
if(forEachBlock(6, 6) == 1) f = 0;
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
}
else f = 1;
if(!f) cout << "Yes" << el;
else cout << "No" << el;
}
int main()
{
optimize();
//testCase
solve();
return 0;
}
Submission Info
| Submission Time |
|
| Task |
C - Number Place |
| User |
InFi4D_0 |
| Language |
C++ 20 (gcc 12.2) |
| Score |
0 |
| Code Size |
3638 Byte |
| Status |
WA |
| Exec Time |
3 ms |
| Memory |
3608 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
0 / 250 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
example_00.txt, example_01.txt, example_02.txt |
| All |
example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt |
| Case Name |
Status |
Exec Time |
Memory |
| example_00.txt |
AC |
1 ms |
3480 KiB |
| example_01.txt |
AC |
1 ms |
3480 KiB |
| example_02.txt |
AC |
1 ms |
3484 KiB |
| hand_00.txt |
WA |
1 ms |
3456 KiB |
| hand_01.txt |
WA |
1 ms |
3476 KiB |
| hand_02.txt |
AC |
1 ms |
3340 KiB |
| random_00.txt |
AC |
1 ms |
3444 KiB |
| random_01.txt |
AC |
1 ms |
3484 KiB |
| random_02.txt |
AC |
1 ms |
3528 KiB |
| random_03.txt |
AC |
1 ms |
3460 KiB |
| random_04.txt |
AC |
1 ms |
3412 KiB |
| random_05.txt |
AC |
1 ms |
3400 KiB |
| random_06.txt |
AC |
1 ms |
3608 KiB |
| random_07.txt |
AC |
1 ms |
3412 KiB |
| random_08.txt |
AC |
1 ms |
3608 KiB |
| random_09.txt |
AC |
1 ms |
3460 KiB |
| random_10.txt |
AC |
1 ms |
3524 KiB |
| random_11.txt |
AC |
1 ms |
3464 KiB |
| random_12.txt |
WA |
1 ms |
3600 KiB |
| random_13.txt |
WA |
1 ms |
3368 KiB |
| random_14.txt |
WA |
1 ms |
3336 KiB |
| random_15.txt |
AC |
1 ms |
3456 KiB |
| random_16.txt |
AC |
1 ms |
3480 KiB |
| random_17.txt |
AC |
1 ms |
3444 KiB |
| random_18.txt |
AC |
1 ms |
3600 KiB |
| random_19.txt |
AC |
1 ms |
3556 KiB |
| random_20.txt |
AC |
1 ms |
3472 KiB |
| random_21.txt |
AC |
1 ms |
3444 KiB |
| random_22.txt |
AC |
1 ms |
3444 KiB |
| random_23.txt |
AC |
1 ms |
3400 KiB |
| random_24.txt |
AC |
3 ms |
3424 KiB |