結果
問題 | No.800 四平方定理 |
ユーザー | spihill |
提出日時 | 2019-03-17 22:20:25 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,796 bytes |
コンパイル時間 | 1,551 ms |
コンパイル使用メモリ | 174,788 KB |
実行使用メモリ | 65,268 KB |
最終ジャッジ日時 | 2023-09-22 07:32:19 |
合計ジャッジ時間 | 24,524 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
4,380 KB |
testcase_01 | AC | 14 ms
4,764 KB |
testcase_02 | AC | 10 ms
4,380 KB |
testcase_03 | AC | 11 ms
4,440 KB |
testcase_04 | AC | 10 ms
4,376 KB |
testcase_05 | AC | 11 ms
4,428 KB |
testcase_06 | AC | 17 ms
5,012 KB |
testcase_07 | AC | 12 ms
4,600 KB |
testcase_08 | AC | 11 ms
4,888 KB |
testcase_09 | AC | 14 ms
4,700 KB |
testcase_10 | AC | 1,018 ms
34,500 KB |
testcase_11 | AC | 1,175 ms
38,280 KB |
testcase_12 | AC | 1,152 ms
37,696 KB |
testcase_13 | AC | 974 ms
35,952 KB |
testcase_14 | AC | 1,101 ms
38,416 KB |
testcase_15 | AC | 1,212 ms
38,124 KB |
testcase_16 | AC | 1,068 ms
38,856 KB |
testcase_17 | AC | 1,155 ms
38,724 KB |
testcase_18 | AC | 1,177 ms
38,512 KB |
testcase_19 | AC | 1,162 ms
38,568 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 2 ms
4,376 KB |
testcase_22 | AC | 1,156 ms
38,784 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | AC | 1 ms
4,376 KB |
testcase_27 | AC | 1 ms
4,376 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
ソースコード
#include <bits/stdc++.h> using ll = long long; using namespace std; #define int ll #define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++) #define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++) #define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--) #define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--) #define MP(a, b) make_pair((a), (b)) #define PB(a) push_back((a)) #define all(v) (v).begin(), (v).end() #define PERM(v) next_permutation(all(v)) #define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end()) #define CIN(type, x) type x;cin >> x #define TRUE__ "Yes" #define FALSE__ "No" #define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;} #define YES(f) if((f)){cout << "YES" << endl;}else{cout << "NO" << endl;} #define Yes(f) if((f)){cout << "Yes" << endl;}else{cout << "No" << endl;} #define MINV(v) min_element(all(v)) #define MAXV(v) max_element(all(v)) #define MIN3(a, b, c) min(min(a, b), c) #define MIN4(a, b, c, d) min(MIN3(a, b, c), d) #define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e) #define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f) #define MAX3(a, b, c) max(max(a, b), c) #define MAX4(a, b, c, d) max(MAX3(a, b, c), d) #define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e) #define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f) #define RANGE(a, b, c) ((a) <= (b) && (b) < (c)) #define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f))) #define chmin(a, b) a = min(a, (b)) #define chmin3(a, b, c) a = MIN3(a, (b), (c)) #define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d)) #define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e)) #define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f)) #define chmax(a, b) a = max(a, (b)) #define chmax3(a, b, c) a = MAX3(a, (b), (c)) #define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d)) #define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e)) #define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f)) #define fcout cout << fixed << setprecision(12) #define RS resize #define CINV(v, N) do {\ v.RS(N);\ rep(i, N) cin >> v[i];\ } while (0); #define RCINV(v, N) do {\ v.RS(N);\ rrep(i, N) cin >> v[i];\ } while (0); #define MOD 1000000007 template<class T> inline T GET() { T x; cin >> x; return x; } void init(); void solve(); signed main() { init(); solve(); } int N, D; map<int, int> m; void init() { cin >> N >> D; int n = N+1; int res = 0; reps(x, 1, n) { reps(y, x+1, n) { m[y*y-x*x] += 1; } } m[0] = N; reps(x, 1, n) { reps(y, x+1, n) { int t = abs(x*x+y*y-D); if (m.count(t)) { res += m[t]; } } } res *= 2; reps(x, 1, n) { int t = abs(x*x+x*x-D); if (m.count(t)) { res += m[t]; } } cout << res << endl; } void solve() { }