답안 #844042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844042 2023-09-05T03:09:29 Z Darren0724 Chessboard (IZhO18_chessboard) C++17
39 / 100
53 ms 1884 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,q;cin>>n>>q;
    
    vector<int> v;
    vector<int> a[2];
    for(int i=1;i<n;i++){
        if(n%i==0){
            v.push_back(i);
            int p=n/i;
            if(p&1){
                a[0].push_back((p*p-1)*i*i/2);
                a[1].push_back((p*p+1)*i*i/2);
            }
            else{
                a[0].push_back(n*n/2);
                a[1].push_back(n*n/2);
            }
        }
    }
    int sz=v.size();
    for(int i=0;i<q;i++){
        int c,d;
        cin>>c>>d>>c>>d;
        c--;d--;
        for(int j=0;j<sz;j++){
            int k=v[j];
            int c1=c/k;
            int d1=d/k;
            c1%=2;
            d1%=2;
            c1^=d1;
            if(c1){
                a[0][j]--;
                a[1][j]++;
            }
            else{
                a[0][j]++;
                a[1][j]--;
            }
        }
    }
    int ans=n*n;
    for(int j=0;j<sz;j++){
        ans=min(ans,a[0][j]);
        ans=min(ans,a[1][j]);
    }
    cout<<ans<<endl;


    return 0;
}
/*
6 8
3 3 3 3
1 2 1 2
3 4 3 4
5 5 5 5
4 3 4 3
4 4 4 4
2 1 2 1
3 6 3 6
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 512 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 1872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 7 ms 856 KB Output is correct
17 Correct 17 ms 1592 KB Output is correct
18 Correct 23 ms 1884 KB Output is correct
19 Correct 48 ms 1708 KB Output is correct
20 Correct 53 ms 1872 KB Output is correct
21 Correct 17 ms 1624 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 14 ms 1112 KB Output is correct
24 Correct 21 ms 1880 KB Output is correct
25 Correct 4 ms 616 KB Output is correct
26 Correct 13 ms 1368 KB Output is correct
27 Correct 17 ms 1368 KB Output is correct
28 Correct 22 ms 1880 KB Output is correct
29 Correct 7 ms 856 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 1872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 512 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 600 KB Output is correct
9 Incorrect 19 ms 1872 KB Output isn't correct
10 Halted 0 ms 0 KB -