結果
問題 | No.869 ふたつの距離 |
ユーザー |
![]() |
提出日時 | 2019-08-15 18:42:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,608 bytes |
コンパイル時間 | 871 ms |
コンパイル使用メモリ | 97,632 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-19 15:31:55 |
合計ジャッジ時間 | 7,920 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 64 WA * 4 TLE * 1 -- * 24 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ int n,a,b; cin>>n>>a>>b; a = b - a; b = n*(n-1)/2-b; rep(p,n+1){ rep(u,n+1){ if(p+u>n||p*u>b)break; rep(r,n+1){ if(p+u+r>n)break; if(r==0&&p*u!=b)continue; if(r!=0&&(b-p*u)%r)continue; rep(s,n+1){ if(p+u+r+s>n)break; if(p*u+r*s!=b)continue; if(p*u+r*s>b)break; rep(t,n+1){ if(p+u+r+s+t>n)break; int q = n-p-u-r-s-t; if(p*u+r*s==b && (p+r)*t+(s+u)*q+p*r+s*u==a){ rep(_,p)cout<<"0 10"<<endl; rep(_,q)cout<<"10 10"<<endl; rep(_,r)cout<<"20 10"<<endl; rep(_,s)cout<<"0 0"<<endl; rep(_,t)cout<<"10 0"<<endl; rep(_,u)cout<<"20 0"<<endl; return 0; } } } } } } return 0; }