답안 #673343

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673343 2022-12-20T08:59:56 Z Cutebol Chessboard (IZhO18_chessboard) C++17
16 / 100
24 ms 1708 KB
#include <bits/stdc++.h>
 
using namespace std;
 
void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define Scaramouche ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
#define int long long
#define itn int
#define endl "\n"
#define ff first
#define ss second
   
const int N = 2e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e12 ;

int n , k , m , sum , ans = inf ;
int x[N] , y[N] , cnt1[2] ;

void solve(){
	
	cin >> n >> m ;
	if ( m == 0 ){
		for ( int i = 1 ; i <= n/2 ; i ++ ){
			if ( !(n % i)){
				n /= i ;
				ans = min ( ans , (n*n/2)*i*i ) ;
				n *= i ;
			}
		}
		cout << ans ;
		return ;
	}
	int cnt[2] ;
	cnt[1] = n*n/2 , cnt[0] = (n*n+1)/2 ;
	for ( int i = 0 ; i < m ; i ++ ){
		cin >> x[i] >> y[i] >> x[i] >> y[i] ;
		cnt[((x[i]%2)+(y[i]%2))%2] -- ;
		cnt[(1+(x[i]%2)+(y[i]%2))%2] ++ ;
	}
	cout << min ( cnt[0] , cnt[1] )  ;
}
 
signed main(){
//  fopn("blocks") ;
    Scaramouche ;
    int t = 1 ;
//    	cin >> t ;
    while ( t -- ) solve() ; 
}

Compilation message

chessboard.cpp: In function 'void fopn(std::string)':
chessboard.cpp:5:31: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chessboard.cpp:5:72: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1236 KB Output is correct
2 Correct 6 ms 596 KB Output is correct
3 Correct 11 ms 860 KB Output is correct
4 Correct 12 ms 1012 KB Output is correct
5 Correct 16 ms 1120 KB Output is correct
6 Correct 9 ms 852 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 10 ms 852 KB Output is correct
9 Correct 24 ms 1708 KB Output is correct
10 Correct 16 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 1236 KB Output is correct
2 Correct 6 ms 596 KB Output is correct
3 Correct 11 ms 860 KB Output is correct
4 Correct 12 ms 1012 KB Output is correct
5 Correct 16 ms 1120 KB Output is correct
6 Correct 9 ms 852 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 10 ms 852 KB Output is correct
9 Correct 24 ms 1708 KB Output is correct
10 Correct 16 ms 1108 KB Output is correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 17 ms 1236 KB Output is correct
10 Correct 6 ms 596 KB Output is correct
11 Correct 11 ms 860 KB Output is correct
12 Correct 12 ms 1012 KB Output is correct
13 Correct 16 ms 1120 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 4 ms 340 KB Output is correct
16 Correct 10 ms 852 KB Output is correct
17 Correct 24 ms 1708 KB Output is correct
18 Correct 16 ms 1108 KB Output is correct
19 Incorrect 1 ms 212 KB Output isn't correct
20 Halted 0 ms 0 KB -