結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
yukinon0808
|
| 提出日時 | 2019-03-17 23:46:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,440 bytes |
| コンパイル時間 | 2,364 ms |
| コンパイル使用メモリ | 155,444 KB |
| 最終ジャッジ日時 | 2024-11-14 21:20:34 |
| 合計ジャッジ時間 | 2,747 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:9:21: error: ‘operator<<’ function uses ‘auto’ type specifier without trailing return type
9 | template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
| ^~~~
main.cpp:9:21: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
main.cpp:10:32: error: ‘operator<<’ function uses ‘auto’ type specifier without trailing return type
10 | template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
| ^~~~
main.cpp:10:32: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
main.cpp:11:21: error: ‘operator<<’ function uses ‘auto’ type specifier without trailing return type
11 | template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
| ^~~~
main.cpp:11:21: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
main.cpp:12:32: error: ‘operator<<’ function uses ‘auto’ type specifier without trailing return type
12 | template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
| ^~~~
main.cpp:12:32: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
ソースコード
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl;
struct edge { int to, cost; };
const int INF = 1e18;
const int MOD = 1e9+7;
signed main()
{
int N, D; cin >> N >> D;
V<int> cnt(2*N*N + 1);
for (int x = 1; x <= N; x++) {
for (int y = 1; y <= N; y++) {
cnt[x*x + y*y]++;
}
}
int ans = 0;
for (int z = 1; z <= N; z++) {
for (int w = 1; w <= N; w++) {
if (0 <= w*w - z*z + D && w*w - z*z + D <= 2*N*N) {
ans += cnt[w*w - z*z + D];
}
}
}
cout << ans << endl;
return 0;
}
yukinon0808