QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100472 | #5553. Alternative Architecture | PetroTarnavskyi# | AC ✓ | 6ms | 3480kb | C++17 | 731b | 2023-04-26 15:06:46 | 2023-04-26 15:06:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
LL a, b;
cin >> a >> b;
a--;
b--;
LL g = gcd(a, b);
int ans = -1;
FOR(x, -g, g + 1) {
LL y = sqrt(g * g - (LL)x * x + 0.5);
if (x * x + y * y == g * g) {
ans++;
}
}
assert(ans % 2 == 0);
if (a == b) {
ans /= 2;
}
cout << ans << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3368kb
input:
6 11
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
26 26
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3264kb
input:
123 456
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3288kb
input:
3 3
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
2 2
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3464kb
input:
2 1000000
output:
2
result:
ok single line: '2'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3256kb
input:
1000000 2
output:
2
result:
ok single line: '2'
Test #8:
score: 0
Accepted
time: 3ms
memory: 3372kb
input:
1000000 1000000
output:
9
result:
ok single line: '9'
Test #9:
score: 0
Accepted
time: 3ms
memory: 3320kb
input:
320451 480676
output:
270
result:
ok single line: '270'
Test #10:
score: 0
Accepted
time: 6ms
memory: 3316kb
input:
801126 801126
output:
189
result:
ok single line: '189'
Test #11:
score: 0
Accepted
time: 3ms
memory: 3432kb
input:
345451 460601
output:
10
result:
ok single line: '10'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
560236 560236
output:
63
result:
ok single line: '63'
Test #13:
score: 0
Accepted
time: 3ms
memory: 3360kb
input:
640901 320451
output:
270
result:
ok single line: '270'
Test #14:
score: 0
Accepted
time: 3ms
memory: 3224kb
input:
549251 274626
output:
98
result:
ok single line: '98'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3260kb
input:
563551 751401
output:
150
result:
ok single line: '150'
Test #16:
score: 0
Accepted
time: 5ms
memory: 3424kb
input:
604251 906376
output:
42
result:
ok single line: '42'
Test #17:
score: 0
Accepted
time: 4ms
memory: 3372kb
input:
556251 834376
output:
66
result:
ok single line: '66'
Test #18:
score: 0
Accepted
time: 4ms
memory: 3260kb
input:
216051 216051
output:
45
result:
ok single line: '45'
Test #19:
score: 0
Accepted
time: 5ms
memory: 3264kb
input:
733526 733526
output:
135
result:
ok single line: '135'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3304kb
input:
475307 950613
output:
54
result:
ok single line: '54'
Test #21:
score: 0
Accepted
time: 5ms
memory: 3196kb
input:
781251 390626
output:
34
result:
ok single line: '34'
Test #22:
score: 0
Accepted
time: 5ms
memory: 3256kb
input:
945051 945051
output:
45
result:
ok single line: '45'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
484201 564901
output:
30
result:
ok single line: '30'
Test #24:
score: 0
Accepted
time: 5ms
memory: 3472kb
input:
645961 645961
output:
9
result:
ok single line: '9'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3284kb
input:
750621 450373
output:
6
result:
ok single line: '6'
Test #26:
score: 0
Accepted
time: 3ms
memory: 3368kb
input:
736951 368476
output:
70
result:
ok single line: '70'
Test #27:
score: 0
Accepted
time: 3ms
memory: 3476kb
input:
867603 433802
output:
18
result:
ok single line: '18'
Test #28:
score: 0
Accepted
time: 3ms
memory: 3320kb
input:
531251 265626
output:
78
result:
ok single line: '78'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3380kb
input:
423501 211751
output:
14
result:
ok single line: '14'
Test #30:
score: 0
Accepted
time: 3ms
memory: 3256kb
input:
390626 390626
output:
17
result:
ok single line: '17'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
2 3
output:
2
result:
ok single line: '2'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
3 2
output:
2
result:
ok single line: '2'