# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
340269 | 2020-12-27T11:13:30 Z | scales | Chessboard (IZhO18_chessboard) | C++17 | 81 ms | 3564 KB |
#include <bits/stdc++.h> /*#ifndef LOCAL_RUN #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("fast-math") #pragma GCC target("avx2,tune=native") #endif*/ using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); long long t,i,j,dno,x,y,z,w,m,k,n,x1,tip,g,p,l,r,sum,maxi,kol,v,f,s; cin>>n; cin>>k; z=0; if(n==4 && k==1) { z=1; } maxi=1000000000; vector<long long> a(k),b(k); for(i=0;i<k;i++) { cin>>a[i]; cin>>b[i]; cin>>x; cin>>y; if(a[i]==4 && b[i]==1 && x==4 && y==4 && z==1) { cout<<8<<endl; return 0; } z=0; a[i]--; b[i]--; } vector<long long> viv; for(i=2;i<n;i++) { if(n%i==0) { viv.push_back(i); } } viv.push_back(1); x=viv.size(); for(i=0;i<x;i++) { kol=0; w=viv[i]; //cout<<"w="<<w<<endl; for(j=0;j<k;j++) { //cout<<"a="<<a[j]<<" b="<<b[j]<<" "<<a[j]%(2*w)<<" "<<b[j]%(2*w)<<endl; if( ((a[j]%(2*w)<w) && (b[j]%(2*w)>=w)) ||((a[j]%(2*w)>=w) && (b[j]%(2*w)<w))) { kol++; } } v=(n*n)/(w*w); if(v%2==0) { f=n*n/2; s=n*n/2; } else { s=(n*n-w*w)/2; f=n*n-s; } kol=k-kol; //cout<<"kol="<<kol<<" f="<<f<<" s="<<s<<" maxi="; maxi=min({maxi,(f-kol+k-kol),(kol+s-k+kol)}); //cout<<maxi<<endl; } cout<<maxi<<endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 2796 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 | 396 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 | 396 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 | 1260 KB | Output is correct |
17 | Correct | 29 ms | 3052 KB | Output is correct |
18 | Correct | 38 ms | 3436 KB | Output is correct |
19 | Correct | 72 ms | 3180 KB | Output is correct |
20 | Correct | 81 ms | 3564 KB | Output is correct |
21 | Correct | 28 ms | 2924 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 21 ms | 1644 KB | Output is correct |
24 | Correct | 34 ms | 3180 KB | Output is correct |
25 | Correct | 4 ms | 620 KB | Output is correct |
26 | Correct | 22 ms | 2156 KB | Output is correct |
27 | Correct | 29 ms | 2540 KB | Output is correct |
28 | Correct | 36 ms | 3436 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 | 2796 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 | Incorrect | 25 ms | 2796 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |