結果

問題 No.869 ふたつの距離
ユーザー tempura_pptempura_pp
提出日時 2019-08-15 18:42:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,608 bytes
コンパイル時間 1,040 ms
コンパイル使用メモリ 97,268 KB
実行使用メモリ 7,796 KB
最終ジャッジ日時 2023-10-19 19:20:57
合計ジャッジ時間 8,307 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 4 ms
4,348 KB
testcase_43 AC 8 ms
4,348 KB
testcase_44 AC 37 ms
4,348 KB
testcase_45 AC 6 ms
4,348 KB
testcase_46 AC 3 ms
4,348 KB
testcase_47 AC 7 ms
4,348 KB
testcase_48 AC 7 ms
4,348 KB
testcase_49 AC 17 ms
4,348 KB
testcase_50 AC 32 ms
4,348 KB
testcase_51 WA -
testcase_52 AC 2 ms
4,348 KB
testcase_53 AC 3 ms
4,348 KB
testcase_54 AC 4 ms
4,348 KB
testcase_55 AC 28 ms
4,348 KB
testcase_56 AC 3 ms
4,348 KB
testcase_57 AC 32 ms
4,348 KB
testcase_58 WA -
testcase_59 AC 5 ms
4,348 KB
testcase_60 AC 11 ms
4,348 KB
testcase_61 AC 11 ms
4,348 KB
testcase_62 TLE -
testcase_63 AC 25 ms
4,348 KB
testcase_64 AC 3 ms
4,348 KB
testcase_65 AC 8 ms
4,348 KB
testcase_66 AC 15 ms
4,348 KB
testcase_67 AC 25 ms
4,348 KB
testcase_68 TLE -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0