Submission details
Task:Simplified Sudoku
Sender:Pohjantahti
Submission time:2018-09-13 17:04:58 +0300
Language:C++
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#2ACCEPTED0.02 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.02 sdetails
#5ACCEPTED0.03 sdetails
#6ACCEPTED0.01 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.02 sdetails
#9ACCEPTED0.02 sdetails
#10ACCEPTED0.03 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:28:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (st.size() != n) {
       ~~~~~~~~~~^~~~
input/code.cpp:37:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (st.size() != n) {
       ~~~~~~~~~~^~~~

Code

#include <iostream>
#include <set>

using namespace std;

int n;
int t[105][105];

void fail() {
	cout << "NO\n";
	exit(0);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> t[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		set<int> st;
		for (int j = 0; j < n; ++j) {
			st.insert(t[i][j]);
		}
		if (st.size() != n) {
			fail();
		}
	}
	for (int j = 0; j < n; ++j) {
		set<int> st;
		for (int i = 0; i < n; ++i) {
			st.insert(t[i][j]);
		}
		if (st.size() != n) {
			fail();
		}
	}
	cout << "YES\n";
	return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1
1

correct output
YES

user output
YES

Test 2

Verdict: ACCEPTED

input
2
1 2
2 1

correct output
YES

user output
YES

Test 3

Verdict: ACCEPTED

input
2
1 1
1 1

correct output
NO

user output
NO

Test 4

Verdict: ACCEPTED

input
2
2 2
2 2

correct output
NO

user output
NO

Test 5

Verdict: ACCEPTED

input
2
1 2
1 2

correct output
NO

user output
NO

Test 6

Verdict: ACCEPTED

input
2
1 2
1 1

correct output
NO

user output
NO

Test 7

Verdict: ACCEPTED

input
100
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

correct output
NO

user output
NO

Test 8

Verdict: ACCEPTED

input
100
32 84 70 64 50 82 33 91 77 56 ...

correct output
NO

user output
NO

Test 9

Verdict: ACCEPTED

input
100
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
YES

user output
YES

Test 10

Verdict: ACCEPTED

input
100
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

correct output
NO

user output
NO