QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#832631#504. ChessboardI_love_Banu#8 27ms3592kbC++141.4kb2024-12-26 00:46:332024-12-26 00:46:34

Judging History

你现在查看的是最新测评结果

  • [2024-12-26 00:46:34]
  • 评测
  • 测评结果:8
  • 用时:27ms
  • 内存:3592kb
  • [2024-12-26 00:46:33]
  • 提交

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);}

con inf = 0x3f3f3f3f;

int main(){
    int N, K;
    cin >> N >> K;

    rep(K){
	int X, Y;
	cin >> X >> Y;
    }

    int ans = inf;

    if (0 == (N & 1)){
	ans = N * N / 2;
    }

    for (int i = 1; i < N; i ++){
	if (0 == N % i){
	    int j = N / i;
	    if (j & 1){
		int x = i * i * (j / 2);
		int y = i * i * (j / 2 + 1);

		ans = min(ans, y * (j / 2) + x * (j / 2 + 1));
	    }
	}
    }

    cout << ans << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 8
Accepted

Test #1:

score: 8
Accepted
time: 0ms
memory: 3584kb

input:

100 0

output:

4800

result:

ok single line: '4800'

Test #2:

score: 8
Accepted
time: 0ms
memory: 3476kb

input:

99 0

output:

4356

result:

ok single line: '4356'

Test #3:

score: 8
Accepted
time: 0ms
memory: 3584kb

input:

98 0

output:

4704

result:

ok single line: '4704'

Test #4:

score: 8
Accepted
time: 0ms
memory: 3592kb

input:

97 0

output:

4704

result:

ok single line: '4704'

Test #5:

score: 8
Accepted
time: 0ms
memory: 3560kb

input:

96 0

output:

4096

result:

ok single line: '4096'

Test #6:

score: 8
Accepted
time: 0ms
memory: 3544kb

input:

95 0

output:

4332

result:

ok single line: '4332'

Test #7:

score: 8
Accepted
time: 0ms
memory: 3528kb

input:

94 0

output:

4416

result:

ok single line: '4416'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 20ms
memory: 3532kb

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:

1061109567

result:

wrong answer 1st lines differ - expected: '1929384918', found: '1061109567'

Subtask #3:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 0ms
memory: 3588kb

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:

2704

result:

wrong answer 1st lines differ - expected: '2732', found: '2704'

Subtask #4:

score: 0
Skipped

Dependency #2:

0%

Subtask #5:

score: 0
Wrong Answer

Test #48:

score: 0
Wrong Answer
time: 27ms
memory: 3536kb

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:

129410960

result:

wrong answer 1st lines differ - expected: '4424387268', found: '129410960'

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%