QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#832635 | #504. Chessboard | I_love_Banu# | 8 | 27ms | 3816kb | C++14 | 1.8kb | 2024-12-26 01:04:27 | 2024-12-26 01:04:29 |
Judging History
answer
#include"bits/stdc++.h"
using namespace std;
#define FOR(i,a,b)for(int i=(a);i<(b);i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=(b)-1;(a)<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)(*max_element(all(a)))
#define MAXX(a,b)(*max_element(a,a+b))
#define MIN(a)(*min_element(all(a)))
#define MINN(a,b)(*min_element(a,a+b))
#define con const int
#ifdef LOCAL
#define print(x)cout<<x
#else
#define print(x)
#endif
using ld=long double;
using ll=long long;
using str=string;
template<class T,class U>ifstream&operator>>(istream&in,pair<T,U>a){return in>>a.first>>a.second;}
void fileset(str a){freopen((a+".in").c_str(),"r",stdin);freopen((a+".out").c_str(),"w",stdout);}
ll cnt[2];
int main(){
int N, K;
cin >> N >> K;
cnt[1] = 2ll * (N / 2) * (N / 2 + 1);
cnt[0] = 1ll * (N / 2 + 1) * (N / 2 + 1) + 1ll * (N / 2) * (N / 2);
rep(K){
int X, Y;
cin >> X >> Y;
if (X & 1){
if (Y & 1){
cnt[0] --;
cnt[1] ++;
} else {
cnt[1] --;
cnt[0] ++;
}
} else {
if (Y & 1){
cnt[1] --;
cnt[0] ++;
} else {
cnt[0] --;
cnt[1] ++;
}
}
}
ll ans = LLONG_MAX;
if (0 == (N & 1)){
ans = 1ll * N * N / 2;
}
if (0 == K){
for (int i = 1; i < N; i ++){
if (0 == N % i){
int j = N / i;
if (j & 1){
ll x = 1ll * i * i * (j / 2);
ll y = 1ll * i * i * (j / 2 + 1);
ans = min(ans, y * (j / 2) + x * (j / 2 + 1));
}
}
}
}
if (0 == K){
cout << ans << endl;
} else {
cout << MINN(cnt, 2) << endl;
}
}
詳細信息
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 0ms
memory: 3500kb
input:
100 0
output:
4800
result:
ok single line: '4800'
Test #2:
score: 8
Accepted
time: 0ms
memory: 3588kb
input:
99 0
output:
4356
result:
ok single line: '4356'
Test #3:
score: 8
Accepted
time: 0ms
memory: 3484kb
input:
98 0
output:
4704
result:
ok single line: '4704'
Test #4:
score: 8
Accepted
time: 0ms
memory: 3600kb
input:
97 0
output:
4704
result:
ok single line: '4704'
Test #5:
score: 8
Accepted
time: 0ms
memory: 3592kb
input:
96 0
output:
4096
result:
ok single line: '4096'
Test #6:
score: 8
Accepted
time: 0ms
memory: 3504kb
input:
95 0
output:
4332
result:
ok single line: '4332'
Test #7:
score: 8
Accepted
time: 0ms
memory: 3816kb
input:
94 0
output:
4416
result:
ok single line: '4416'
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 21ms
memory: 3596kb
input:
62119 62603 12553 17025 12553 17025 6889 49271 6889 49271 22523 10778 22523 10778 27058 28538 27058 28538 39696 26638 39696 26638 59348 52344 59348 52344 53272 14810 53272 14810 29522 5148 29522 5148 52527 55935 52527 55935 43346 19863 43346 19863 49934 33407 49934 33407 57492 27016 57492 27016 7355...
output:
1929384986
result:
wrong answer 1st lines differ - expected: '1929384918', found: '1929384986'
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3420kb
input:
78 280 55 71 55 71 22 73 22 73 60 30 60 30 28 11 28 11 51 39 51 39 21 33 21 33 25 32 25 32 42 54 42 54 62 71 62 71 23 31 23 31 75 1 75 1 56 76 56 76 33 9 33 9 9 76 9 76 77 67 77 67 68 21 68 21 62 24 62 24 32 70 32 70 41 2 41 2 58 58 58 58 65 14 65 14 66 72 66 72 72 21 72 21 71 63 71 63 13 18 13 18 6...
output:
3081
result:
wrong answer 1st lines differ - expected: '2732', found: '3081'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #48:
score: 0
Wrong Answer
time: 27ms
memory: 3596kb
input:
99774 82706 29912 70150 29912 70150 93471 873 93471 873 64978 14740 64978 14740 57016 16856 57016 16856 93392 19170 93392 19170 28713 63187 28713 63187 65553 40025 65553 40025 97816 38346 97816 38346 4184 36771 4184 36771 63515 21172 63515 21172 39860 95092 39860 95092 62818 96699 62818 96699 74942 ...
output:
4977525311
result:
wrong answer 1st lines differ - expected: '4424387268', found: '4977525311'
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%