답안 #92988

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
92988 2019-01-06T09:42:59 Z Moysenko Chessboard (IZhO18_chessboard) C++17
70 / 100
120 ms 3548 KB
/*ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░ 
▄███▀░◐░░░▌░░░░░░░ 
░░░░▌░░░░░▐░░░░░░░ 
░░░░▐░░░░░▐░░░░░░░ 
░░░░▌░░░░░▐▄▄░░░░░ 
░░░░▌░░░░▄▀▒▒▀▀▀▀▄ 
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄ 
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄ 
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄ 
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄ 
░░░░░░░░░░░▌▌░▌▌░░░░░ 
░░░░░░░░░░░▌▌░▌▌░░░░░ 
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
НАСТРОЙКА НА КРИТЫ ██████████████] 100% СОЧНОСТИ*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <chrono>
#include <ctime>
#include <unordered_set>
#include <random>
  
#define ep emplace_back
#define F first
#define S second
  
using namespace std;
  
typedef long long ll;
typedef long double ld;
const int inf = 1e9 + 7;
mt19937 rd(chrono :: system_clock :: now().time_since_epoch().count());
  
#pragma GCC optimize("unroll-loops") // развернуть цикл
#pragma GCC optimize("Ofast") // скомпилировать с о3
/*
#pragma GCC optimize("no-stack-protector") // что-то со стеком
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") // оптимизации процессора
#pragma GCC optimize("fast-math") // оптимизации сопроцессора
*/

const int siz = 1e5 + 10;
int K, x[siz], y[siz];
ll n;

ll Solve(int l){
	ll k1 = (n / l + 1) / 2, k2 = (n / l) / 2;
	ll all = k1 * k1 + k2 * k2;
	all *= (ll)l * l;

	int ox, oy;
	for (int i = 0; i < K; i++){
		ox = x[i] % (2 * l);
		oy = y[i] % (2 * l);

		if (!((ox < l) ^ (oy < l)))
			all--;
		else
			all++;
	}

	//cout << l << ' ' << all << '\n';

	return min(all, n * n - all);
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    cin >> n >> K;
    int i, tx, ty;
   	for (i = 0; i < K; i++){
   		cin >> x[i] >> y[i] >> tx >> ty;
   		if (x[i] != tx || y[i] != ty){
   			cout << 8;
   			return 0;
   		}
   		x[i]--, y[i]--;
   	}

   	ll ans = Solve(1);
   	for (i = 2; i * i <= n; i++)
   		if (n % i == 0)
   			ans = min(ans, min(Solve(i), Solve(n / i)));

   	cout << ans;
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 760 KB Output is correct
2 Correct 7 ms 504 KB Output is correct
3 Correct 16 ms 632 KB Output is correct
4 Correct 16 ms 632 KB Output is correct
5 Correct 20 ms 760 KB Output is correct
6 Correct 13 ms 632 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 13 ms 632 KB Output is correct
9 Correct 32 ms 1016 KB Output is correct
10 Correct 19 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 10 ms 504 KB Output is correct
17 Correct 25 ms 1016 KB Output is correct
18 Correct 32 ms 1144 KB Output is correct
19 Correct 41 ms 972 KB Output is correct
20 Correct 45 ms 1172 KB Output is correct
21 Correct 24 ms 1016 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 15 ms 760 KB Output is correct
24 Correct 28 ms 976 KB Output is correct
25 Correct 5 ms 376 KB Output is correct
26 Correct 18 ms 760 KB Output is correct
27 Correct 23 ms 888 KB Output is correct
28 Correct 29 ms 1016 KB Output is correct
29 Correct 11 ms 632 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 760 KB Output is correct
2 Correct 7 ms 504 KB Output is correct
3 Correct 16 ms 632 KB Output is correct
4 Correct 16 ms 632 KB Output is correct
5 Correct 20 ms 760 KB Output is correct
6 Correct 13 ms 632 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 13 ms 632 KB Output is correct
9 Correct 32 ms 1016 KB Output is correct
10 Correct 19 ms 760 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 380 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 10 ms 504 KB Output is correct
27 Correct 25 ms 1016 KB Output is correct
28 Correct 32 ms 1144 KB Output is correct
29 Correct 41 ms 972 KB Output is correct
30 Correct 45 ms 1172 KB Output is correct
31 Correct 24 ms 1016 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 15 ms 760 KB Output is correct
34 Correct 28 ms 976 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 18 ms 760 KB Output is correct
37 Correct 23 ms 888 KB Output is correct
38 Correct 29 ms 1016 KB Output is correct
39 Correct 11 ms 632 KB Output is correct
40 Correct 3 ms 376 KB Output is correct
41 Correct 42 ms 3020 KB Output is correct
42 Correct 36 ms 3288 KB Output is correct
43 Correct 35 ms 2936 KB Output is correct
44 Correct 33 ms 3320 KB Output is correct
45 Correct 35 ms 3448 KB Output is correct
46 Correct 46 ms 3320 KB Output is correct
47 Correct 31 ms 3068 KB Output is correct
48 Correct 35 ms 3064 KB Output is correct
49 Correct 31 ms 3028 KB Output is correct
50 Correct 107 ms 3276 KB Output is correct
51 Correct 115 ms 3548 KB Output is correct
52 Correct 105 ms 3212 KB Output is correct
53 Correct 113 ms 3448 KB Output is correct
54 Correct 106 ms 3192 KB Output is correct
55 Correct 120 ms 3524 KB Output is correct
56 Correct 101 ms 3064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 24 ms 760 KB Output is correct
10 Correct 7 ms 504 KB Output is correct
11 Correct 16 ms 632 KB Output is correct
12 Correct 16 ms 632 KB Output is correct
13 Correct 20 ms 760 KB Output is correct
14 Correct 13 ms 632 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 13 ms 632 KB Output is correct
17 Correct 32 ms 1016 KB Output is correct
18 Correct 19 ms 760 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 376 KB Output is correct
31 Correct 2 ms 380 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 10 ms 504 KB Output is correct
35 Correct 25 ms 1016 KB Output is correct
36 Correct 32 ms 1144 KB Output is correct
37 Correct 41 ms 972 KB Output is correct
38 Correct 45 ms 1172 KB Output is correct
39 Correct 24 ms 1016 KB Output is correct
40 Correct 2 ms 376 KB Output is correct
41 Correct 15 ms 760 KB Output is correct
42 Correct 28 ms 976 KB Output is correct
43 Correct 5 ms 376 KB Output is correct
44 Correct 18 ms 760 KB Output is correct
45 Correct 23 ms 888 KB Output is correct
46 Correct 29 ms 1016 KB Output is correct
47 Correct 11 ms 632 KB Output is correct
48 Correct 3 ms 376 KB Output is correct
49 Correct 42 ms 3020 KB Output is correct
50 Correct 36 ms 3288 KB Output is correct
51 Correct 35 ms 2936 KB Output is correct
52 Correct 33 ms 3320 KB Output is correct
53 Correct 35 ms 3448 KB Output is correct
54 Correct 46 ms 3320 KB Output is correct
55 Correct 31 ms 3068 KB Output is correct
56 Correct 35 ms 3064 KB Output is correct
57 Correct 31 ms 3028 KB Output is correct
58 Correct 107 ms 3276 KB Output is correct
59 Correct 115 ms 3548 KB Output is correct
60 Correct 105 ms 3212 KB Output is correct
61 Correct 113 ms 3448 KB Output is correct
62 Correct 106 ms 3192 KB Output is correct
63 Correct 120 ms 3524 KB Output is correct
64 Correct 101 ms 3064 KB Output is correct
65 Correct 2 ms 376 KB Output is correct
66 Correct 2 ms 376 KB Output is correct
67 Incorrect 2 ms 376 KB Output isn't correct
68 Halted 0 ms 0 KB -