# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334379 | 2020-12-09T05:34:30 Z | juggernaut | Chessboard (IZhO18_chessboard) | C++14 | 75 ms | 3436 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; struct Rect{ ll x,y,x2,y2; void _minus(){ x--,y--,x2--,y2--; } }rect[100005]; ll n,m; ll solve(int side){ int sz=n/side; ll wh=0,bl=side*side*((sz*sz+1)>>1); for(int i=0;i<m;i++){ int block_x=rect[i].x/side; int block_y=rect[i].y/side; if((block_x+block_y)&1)wh++; else bl--; } return min(wh+bl,n*n-wh-bl); } int main(){ scanf("%lld%lld",&n,&m); for(ll i=0;i<m;i++)scanf("%lld%lld%lld%lld",&rect[i].x,&rect[i].y,&rect[i].x2,&rect[i].y2),rect[i]._minus(); ll res=solve(1); for(ll i=2;i*i<=n;i++)if(n%i==0)res=min(res,min(solve(i),solve(n/i))); printf("%lld",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 2284 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 1 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 11 ms | 1336 KB | Output is correct |
17 | Correct | 29 ms | 3052 KB | Output is correct |
18 | Correct | 48 ms | 3436 KB | Output is correct |
19 | Correct | 67 ms | 3052 KB | Output is correct |
20 | Correct | 75 ms | 3436 KB | Output is correct |
21 | Correct | 28 ms | 2796 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 20 ms | 1644 KB | Output is correct |
24 | Correct | 35 ms | 3180 KB | Output is correct |
25 | Correct | 4 ms | 620 KB | Output is correct |
26 | Correct | 28 ms | 2028 KB | Output is correct |
27 | Correct | 35 ms | 2412 KB | Output is correct |
28 | Correct | 35 ms | 3308 KB | Output is correct |
29 | Correct | 12 ms | 1388 KB | Output is correct |
30 | Correct | 2 ms | 364 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 2284 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Incorrect | 25 ms | 2284 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |