Task: | Grid |
Sender: | Xellos |
Submission time: | 2017-01-19 23:32:01 +0200 |
Language: | C++ |
Status: | READY |
Result: | 35 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.04 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 1 | details |
#3 | ACCEPTED | 0.04 s | 1 | details |
#4 | ACCEPTED | 0.04 s | 1 | details |
#5 | ACCEPTED | 0.05 s | 1 | details |
#6 | ACCEPTED | 0.03 s | 1 | details |
#7 | ACCEPTED | 0.04 s | 1 | details |
#8 | ACCEPTED | 0.06 s | 1 | details |
#9 | ACCEPTED | 0.07 s | 1 | details |
#10 | ACCEPTED | 0.04 s | 2 | details |
#11 | ACCEPTED | 0.04 s | 2 | details |
#12 | WRONG ANSWER | 0.04 s | 2 | details |
#13 | WRONG ANSWER | 0.02 s | 2 | details |
#14 | WRONG ANSWER | 0.04 s | 2 | details |
#15 | WRONG ANSWER | 0.04 s | 2 | details |
#16 | ACCEPTED | 0.04 s | 3 | details |
#17 | ACCEPTED | 0.05 s | 3 | details |
#18 | WRONG ANSWER | 0.04 s | 3 | details |
#19 | WRONG ANSWER | 0.05 s | 3 | details |
#20 | WRONG ANSWER | 0.08 s | 3 | details |
#21 | WRONG ANSWER | 0.08 s | 3 | details |
Code
#include <bits/stdc++.h>// iostream is too mainstream#include <cstdio>// bitch please#include <iostream>#include <algorithm>#include <cstdlib>#include <vector>#include <set>#include <map>#include <queue>#include <stack>#include <list>#include <cmath>#include <iomanip>#include <time.h>#define dibs reserve#define OVER9000 1234567890#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)#define tisic 47#define soclose 1e-8#define chocolate win// so much chocolate#define patkan 9#define ff first#define ss second#define abs(x) ((x < 0)?-(x):x)#define uint unsigned int#define dbl long double#define pi 3.14159265358979323846using namespace std;// mylittledoge#ifdef DONLINE_JUDGE// palindromic tree is better than splay tree!#define lld I64d#endif/*Spurdo Spärde :DDDDSPEDE BEARDPEDRO SPORAPURJO PORESPEARMINT PUDDINGSPORO LOROPUDRO BARDEBENIS XDDDD :DDD XD*/int main() {cin.sync_with_stdio(0);cin.tie(0);cout << fixed << setprecision(10);int N;cin >> N;if(N <= 3) {cout << "QAQ\n"; return 0;}srand(N);vector< vector<int> > ans(N,vector<int>(N));vector<int> fr;for(int i =0; i < N; i++) for(int j =1; j <= N; j++) fr.push_back(j);for(int i =0; i < N; i++) for(int j =0; j < N; j++) {int x =rand()%fr.size();swap(fr[fr.size()-1],fr[x]);ans[i][j] =fr.back();fr.pop_back();}map<int,set<int>> sums;for(int i =0; i < N; i++) {int s =0;for(int j =0; j < N; j++) s +=ans[i][j];sums[s].insert(i+1);s =0;for(int j =0; j < N; j++) s +=ans[j][i];sums[s].insert(-i-1);}set<int> n1p;ALL_THE(sums,it) if((it->ss).size() > 1) n1p.insert(it->ff);if(N <= 11) {int st =0;while(!n1p.empty()) {st++;for(int i =0; i < N; i++) for(int j =1; j <= N; j++) fr.push_back(j);for(int i =0; i < N; i++) for(int j =0; j < N; j++) {int x =rand()%fr.size();swap(fr[fr.size()-1],fr[x]);ans[i][j] =fr.back();fr.pop_back();}sums.clear();for(int i =0; i < N; i++) {int s =0;for(int j =0; j < N; j++) s +=ans[i][j];sums[s].insert(i+1);s =0;for(int j =0; j < N; j++) s +=ans[j][i];sums[s].insert(-i-1);}n1p.clear();ALL_THE(sums,it) if((it->ss).size() > 1) n1p.insert(it->ff);}// cout << st << "\n";for(int i =0; i < N; i++)for(int j =0; j < N; j++) cout << ans[i][j] << ((j == N-1)?"\n":" ");return 0;}return 0;}// look at my code// my code is amazing
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 4 1 1 2 3 2 4 3 3 1 2 1 4 |
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 |
---|
1 3 3 4 1 1 4 5 2 1 2 4 3 4 3 1 5 2 4 2 3 5 5 5 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 |
---|
2 1 4 5 3 4 6 5 6 3 5 2 6 3 6 5 1 4 2 4 4 5 5 6 3 2 3 3 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 |
---|
7 5 2 2 1 7 5 5 3 3 1 1 5 3 6 2 5 1 6 1 2 4 3 3 4 7 3 4 7 6 6 6 7 4 3 ... |
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 4 4 7 5 4 5 3 2 1 2 8 2 3 8 3 1 4 7 6 8 3 2 8 2 7 5 8 5 6 7 3 6 7 1 8 2 4 2 4 ... |
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 |
---|
5 7 9 2 6 4 5 1 9 7 7 8 6 9 7 3 6 8 7 2 2 3 2 4 4 7 6 8 3 5 2 1 1 7 9 9 1 2 5 3 5 7 3 8 5 ... |
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 |
---|
10 10 10 10 5 10 9 4 3 3 2 2 3 4 9 7 1 6 6 9 9 8 4 8 2 5 4 9 6 5 1 3 1 7 10 2 8 7 4 7 7 7 9 3 8 4 4 9 8 5 ... |
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 4 3 4 1 1 2 3 2 4 3 3 1 2 1 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 |
---|
(empty) |
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 |
---|
(empty) |
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 |
---|
(empty) |
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 |
---|
(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 |
---|
2 4 3 4 1 1 2 3 2 4 3 3 1 2 1 4 |
Test 18
Group: 3
Verdict: WRONG ANSWER
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: WRONG ANSWER
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: WRONG ANSWER
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: WRONG ANSWER
input |
---|
991 |
correct output |
---|
2 3 4 5 6 7 8 9 10 11 12 13 14... |
user output |
---|
(empty) |