Submission #51104

# Submission time Handle Problem Language Result Execution time Memory
51104 2018-06-16T04:36:44 Z Yusup01 Chessboard (IZhO18_chessboard) C++17
23 / 100
43 ms 4744 KB
#include<bits/stdc++.h>
using namespace std;
int i,j,k,l,m,jog,jog1=1000009,a[1009][1009],x[10009],y[10009],x2[10009],y2[10009],u,p,t,n;
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>k;
	for(int i=1; i<=k; i++)
	{
		cin>>x[i]>>y[i]>>x2[i]>>y2[i];
		if(a[x[i]][y[i]]!=1) u++; a[x[i]][y[i]]=1;
	}
	for(int t=1; t<=n/2; t++)
	{
		if(n%t==0)
		{
			jog=0; p=u; m=0;
			for(int i=1; i<=n; i++)
			{
				m++;
				for(int j=1; j<=n; j++)
				{
					if(m<=t&&j==1) l=0; else if(m>t&&j==1) l=t; l++;
					if(l<=t)
					{
						if(a[i][j]!=1) jog++;
						else p--;
					}
					if(l==t*2) l=0; 
				}
				if(m==t*2) m=0;
			}
			jog1=min(jog1,jog+p); jog=0; p=u; m=0;
			for(int i=1; i<=n; i++)
			{
				m++;
				for(int j=1; j<=n; j++)
				{
					if(m<=t&&j==1) l=t; else if(m>t&&j==1) l=0; l++;
					if(l<=t)
					{
						if(a[i][j]!=1) jog++;
						else p--;
					}
					if(l==t*2) l=0; 
				}
				if(m==t*2) m=0;
			}
			jog1=min(jog1,jog+p);
		}
	}
	cout<<jog1;
}

Compilation message

chessboard.cpp: In function 'int main()':
chessboard.cpp:11:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(a[x[i]][y[i]]!=1) u++; a[x[i]][y[i]]=1;
   ^~
chessboard.cpp:11:29: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if(a[x[i]][y[i]]!=1) u++; a[x[i]][y[i]]=1;
                             ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 716 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 732 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1084 KB Output is correct
2 Correct 2 ms 1084 KB Output is correct
3 Correct 3 ms 1120 KB Output is correct
4 Correct 3 ms 1252 KB Output is correct
5 Correct 2 ms 1252 KB Output is correct
6 Correct 2 ms 1252 KB Output is correct
7 Correct 2 ms 1288 KB Output is correct
8 Correct 3 ms 1288 KB Output is correct
9 Correct 2 ms 1288 KB Output is correct
10 Correct 2 ms 1288 KB Output is correct
11 Correct 2 ms 1288 KB Output is correct
12 Correct 2 ms 1288 KB Output is correct
13 Correct 3 ms 1288 KB Output is correct
14 Correct 3 ms 1288 KB Output is correct
15 Correct 2 ms 1288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1084 KB Output is correct
2 Correct 2 ms 1084 KB Output is correct
3 Correct 3 ms 1120 KB Output is correct
4 Correct 3 ms 1252 KB Output is correct
5 Correct 2 ms 1252 KB Output is correct
6 Correct 2 ms 1252 KB Output is correct
7 Correct 2 ms 1288 KB Output is correct
8 Correct 3 ms 1288 KB Output is correct
9 Correct 2 ms 1288 KB Output is correct
10 Correct 2 ms 1288 KB Output is correct
11 Correct 2 ms 1288 KB Output is correct
12 Correct 2 ms 1288 KB Output is correct
13 Correct 3 ms 1288 KB Output is correct
14 Correct 3 ms 1288 KB Output is correct
15 Correct 2 ms 1288 KB Output is correct
16 Incorrect 43 ms 4744 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 732 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 360 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 2 ms 588 KB Output is correct
6 Correct 2 ms 716 KB Output is correct
7 Correct 2 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Runtime error 2 ms 732 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Halted 0 ms 0 KB -