CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:Microwave Abuser
Submission time:2019-09-30 19:17:57 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails

Code

//g++ -std=c++11 -O2 -Wall microwave.cpp -o microwave
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	//COMMENCE CODE
	int gayarray[111][111];

	for(int x = 1; x <= 104; x++)
	{
		if(x % 4 == 0)
		{
			int i = 1;
			for(int y = x; y <= 104;)
			{
				gayarray[x][y] = i;
				gayarray[y][x] = i;
				i++;
				gayarray[x][y-1] = i;
				gayarray[y-1][x] = i;
				i++;
				gayarray[x][y-2] = i;
				gayarray[y-2][x] = i;
				i++;
				gayarray[x][y-3] = i;
				gayarray[y-3][x] = i;
				i++;
				y += 4;
			}
		}
		else if(x % 3 == 0)
		{
			int i = 1;
			for(int y = x; y <= 103;)
			{
				gayarray[x][y] = i;
				gayarray[y][x] = i;
				i++;
				gayarray[x][y+1] = i;
				gayarray[y+1][x] = i;
				i++;
				gayarray[x][y-2] = i;
				gayarray[y-2][x] = i;
				i++;
				gayarray[x][y-1] = i;
				gayarray[y-1][x] = i;
				i++;
				y += 4;
			}
		}
		else if(x % 2 == 0)
		{
			int i = 1;
			for(int y = x; y <= 102;)
			{
				gayarray[x][y] = i;
				gayarray[y][x] = i;
				i++;
				gayarray[x][y-1] = i;
				gayarray[y-1][x] = i;
				i++;
				gayarray[x][y+2] = i;
				gayarray[y+2][x] = i;
				i++;
				gayarray[x][y+1] = i;
				gayarray[y+1][x] = i;
				i++;
				y += 4;
			}
		}
		else
		{
			int i = 1;
			for(int y = x; y <= 109;)
			{
				gayarray[x][y] = i;
				gayarray[y][x] = i;
				y++;
				i++;
			}	
		}
	}
	

	//Ask table size
	int n;
	cin >> n;
	//print
	for(int y = 1; y <= n; y++)
	{
		for(int x = 1; x <= n; x++)
		{
			printf("%d", gayarray[x][y]);
			if(x != n)
			{
				printf(" ");
			}
		}
		if(y != n)
		{
			printf("\n");
		}
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output

user output
1

Test 2

Verdict: ACCEPTED

input
2

correct output
1 2 
2 1 

user output
1 2
2 1

Test 3

Verdict: ACCEPTED

input
5

correct output
1 2 3 4 5 
2 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

user output
1 2 3 4 5
2 1 4 3 6
3 4 1 2 7
4 3 2 1 8
5 6 7 8 1

Test 4

Verdict:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...
Truncated

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...
Truncated

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...
Truncated