| Task: | Ruudukko |
| Sender: | Kuha |
| Submission time: | 2017-01-19 13:51:00 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 35 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 35 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.03 s | 1 | details |
| #2 | ACCEPTED | 0.03 s | 1 | details |
| #3 | ACCEPTED | 0.05 s | 1 | details |
| #4 | ACCEPTED | 0.04 s | 1 | details |
| #5 | ACCEPTED | 0.03 s | 1 | details |
| #6 | ACCEPTED | 0.03 s | 1 | details |
| #7 | ACCEPTED | 0.04 s | 1 | details |
| #8 | ACCEPTED | 0.04 s | 1 | details |
| #9 | ACCEPTED | 0.03 s | 1 | details |
| #10 | ACCEPTED | 0.05 s | 2 | details |
| #11 | ACCEPTED | 0.04 s | 2 | details |
| #12 | ACCEPTED | 0.72 s | 2 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #16 | ACCEPTED | 0.04 s | 3 | details |
| #17 | ACCEPTED | 0.03 s | 3 | details |
| #18 | RUNTIME ERROR | 0.21 s | 3 | details |
| #19 | RUNTIME ERROR | 0.18 s | 3 | details |
| #20 | RUNTIME ERROR | 0.16 s | 3 | details |
| #21 | RUNTIME ERROR | 0.18 s | 3 | details |
Compiler report
input/code.cpp: In function 'bool check()':
input/code.cpp:24:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
return s.size() == 2 * n;
^Code
#include <bits/stdc++.h>
#define ll long long
using namespace std;
// otetaan eka test case
int v[100][100];
int n;
bool check () {
set<int> s;
for (int i = 0; i < n; i++) {
int x = 0;
for (int j = 0; j < n; j++) x += v[i][j];
s.insert(x);
}
for (int i = 0; i < n; i++) {
int x = 0;
for (int j = 0; j < n; j++) x += v[j][i];
s.insert(x);
}
return s.size() == 2 * n;
}
int main () {
srand(time(0));
cin>>n;
if (n <= 3) {
cout<<"QAQ"<<endl;
return 0;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) v[i][j] = i + 1;
}
while (!check()) {
int i = rand() % n;
if (rand() & 1) {
random_shuffle(v[i], v[i] + n);
} else {
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) swap(v[i][j], v[j][i]);
}
random_shuffle(v[i], v[i] + n);
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) swap(v[i][j], v[j][i]);
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) cout<<v[i][j]<<" ";
cout<<endl;
}
}
Test details
Test 1
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 2 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 2
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 3
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 2 4 3 3 1 2 4 1 2 4 4 3 1 1 3 2 |
Test 4
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 5 |
| correct output |
|---|
| 2 3 4 1 1 3 4 2 1 2 4 2 3 1 3 4 3 2 1 4 5 5 5 5 5 |
| user output |
|---|
| 2 3 2 1 2 2 2 4 5 1 4 5 5 4 5 1 1 5 3 1 3 4 3 3 4 |
Test 5
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 6 |
| correct output |
|---|
| 2 3 4 5 1 1 3 4 5 2 1 2 4 5 2 3 1 3 5 2 3 4 1 4 5 4 3 2 1 5 ... |
| user output |
|---|
| 6 6 4 5 6 4 2 3 2 4 6 1 5 4 5 2 6 4 5 5 6 1 5 3 1 1 3 1 2 4 ... |
Test 6
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 7 |
| correct output |
|---|
| 2 3 4 5 6 1 1 3 4 5 6 2 1 2 4 5 6 2 3 1 3 5 6 2 3 4 1 4 6 2 3 4 5 1 5 ... |
| user output |
|---|
| 4 5 3 7 1 7 6 3 7 5 3 3 4 6 4 7 4 3 3 6 5 2 3 1 6 5 7 1 4 6 2 4 4 2 2 ... |
Test 7
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 8 |
| correct output |
|---|
| 2 3 4 5 6 7 1 1 3 4 5 6 7 2 1 2 4 5 6 7 2 3 1 3 5 6 7 2 3 4 1 4 6 7 2 3 4 5 1 5 ... |
| user output |
|---|
| 6 4 4 5 5 6 2 4 1 1 7 3 2 8 3 6 7 2 6 4 2 3 1 5 6 3 4 4 5 2 4 7 3 4 6 8 8 1 8 8 ... |
Test 8
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 9 |
| correct output |
|---|
| 2 3 4 5 6 7 8 1 1 3 4 5 6 7 8 2 1 2 4 5 6 7 8 2 3 1 3 5 6 7 8 2 3 4 1 4 6 7 8 2 3 4 5 1 5 ... |
| user output |
|---|
| 3 1 2 2 6 2 9 6 6 1 7 6 6 5 3 8 8 6 5 7 8 5 3 7 8 9 3 8 5 2 5 3 5 7 4 8 2 4 1 6 4 3 9 7 7 ... |
Test 9
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 10 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 1 1 3 4 5 6 7 8 9 2 1 2 4 5 6 7 8 9 2 3 1 3 5 6 7 8 9 2 3 4 1 4 6 7 8 9 2 3 4 5 1 5 ... |
| user output |
|---|
| 1 2 2 4 3 6 1 3 10 3 7 7 6 7 6 1 7 5 3 1 2 4 1 6 4 1 7 1 9 9 6 4 5 7 8 4 10 5 9 3 6 7 8 3 5 2 10 1 3 8 ... |
Test 10
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 11
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 2 3 4 4 1 3 4 3 1 1 4 3 2 1 2 2 |
Test 12
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 29 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| 27 14 16 16 6 11 11 11 23 25 2... |
Test 13
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 48 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 14
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 80 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 15
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 97 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 16
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 3 |
| correct output |
|---|
| QAQ |
| user output |
|---|
| QAQ |
Test 17
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 4 |
| correct output |
|---|
| 3 4 3 4 3 1 1 2 4 4 3 2 2 2 1 1 |
| user output |
|---|
| 3 1 2 2 4 1 3 4 2 1 1 2 4 4 3 3 |
Test 18
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 111 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 19
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 506 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 20
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 844 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
Test 21
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 991 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| (empty) |
