| Task: | Grid |
| Sender: | FredrikEkholm |
| Submission time: | 2017-01-22 19:27:02 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | WRONG ANSWER | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | 1 | details |
| #2 | ACCEPTED | 0.04 s | 1 | details |
| #3 | ACCEPTED | 0.06 s | 1 | details |
| #4 | ACCEPTED | 0.04 s | 1 | details |
| #5 | ACCEPTED | 0.04 s | 1 | details |
| #6 | ACCEPTED | 0.04 s | 1 | details |
| #7 | ACCEPTED | 0.04 s | 1 | details |
| #8 | WRONG ANSWER | 0.05 s | 1 | details |
| #9 | ACCEPTED | 0.04 s | 1 | details |
| #10 | ACCEPTED | 0.03 s | 2 | details |
| #11 | ACCEPTED | 0.04 s | 2 | details |
| #12 | WRONG ANSWER | 0.09 s | 2 | details |
| #13 | WRONG ANSWER | 0.10 s | 2 | details |
| #14 | WRONG ANSWER | 0.19 s | 2 | details |
| #15 | WRONG ANSWER | 0.27 s | 2 | details |
| #16 | ACCEPTED | 0.04 s | 3 | details |
| #17 | ACCEPTED | 0.04 s | 3 | details |
| #18 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #19 | RUNTIME ERROR | 0.19 s | 3 | details |
| #20 | RUNTIME ERROR | 0.17 s | 3 | details |
| #21 | RUNTIME ERROR | 0.18 s | 3 | details |
Code
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < int(b); ++i)
#define trav(a, v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define D(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main() {
int n;
cin>>n;
int nums[101];
vector<int> rowSums(n);
vector<int> colSums(n);
int grid[101][101];
srand (time(NULL));
rep(x,0,1000){
rep(i,0,101)
nums[i] = 0;
rowSums.resize(0);
colSums.resize(0);
rowSums.resize(n);
colSums.resize(n);
rep(i,0,n){
int rowSum = 0;
rep(j,0,n){
int number = (rand()%n) + 1;
while(nums[number]==n){
number = (rand()%n) + 1;
}
++nums[number];
grid[i][j] = number;
rowSum += number;
colSums[j] += number;
}
rowSums[i] = rowSum;
}
vector<int> allSums = rowSums;
allSums.insert( allSums.end(), colSums.begin(), colSums.end() );
sort( allSums.begin(), allSums.end());
//rep(i,0,allSums.size())
// cout<<allSums[i]<<" ";
//cout<<endl;
if (adjacent_find (allSums.begin(), allSums.end())==allSums.end()){
rep(i,0,n){
rep(j,0,n){
cout << grid[i][j] << " ";
}
cout<<endl;
}
return 0;
}
}
cout<<"QAQ";
}
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 |
|---|
| 4 4 3 4 3 4 1 2 2 3 1 2 2 3 1 1 |
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 |
|---|
| 3 4 4 1 1 5 5 2 1 3 1 2 2 2 1 3 5 5 4 3 3 5 4 4 2 |
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 5 6 5 2 1 6 5 5 3 5 4 4 5 6 1 6 1 6 1 4 1 3 3 4 2 4 4 2 1 ... |
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 |
|---|
| 5 7 3 6 6 5 3 7 7 5 4 5 6 2 5 7 3 2 2 6 1 6 7 5 1 7 6 7 2 1 6 5 2 3 4 ... |
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 |
|---|
| 1 3 1 4 2 1 6 7 5 5 6 7 6 6 7 6 7 1 1 3 7 5 4 8 3 7 5 2 7 7 8 2 1 2 3 1 1 5 4 6 ... |
Test 8
Group: 1
Verdict: WRONG ANSWER
| 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 |
|---|
| QAQ |
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 |
|---|
| 3 7 3 4 7 8 7 9 4 9 1 4 2 6 3 6 7 2 5 3 1 10 6 5 9 9 6 10 5 2 5 9 1 9 3 7 6 9 7 9 7 7 4 10 2 7 7 10 10 3 ... |
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 |
|---|
| 1 2 2 3 1 1 2 3 1 4 3 4 2 4 3 4 |
Test 12
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 29 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| QAQ |
Test 13
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 48 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| QAQ |
Test 14
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 80 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| QAQ |
Test 15
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 97 |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 11 12 13 14... |
| user output |
|---|
| QAQ |
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 |
|---|
| 4 2 4 4 1 1 4 2 1 1 2 2 3 3 3 3 |
Test 18
Group: 3
Verdict: TIME LIMIT EXCEEDED
| 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) |
