結果
問題 | No.1200 お菓子配り-3 |
ユーザー | daikisuyama |
提出日時 | 2020-08-28 22:59:45 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,523 bytes |
コンパイル時間 | 2,744 ms |
コンパイル使用メモリ | 172,932 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-04-27 00:21:40 |
合計ジャッジ時間 | 9,017 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 6 ms
6,940 KB |
testcase_08 | AC | 6 ms
6,944 KB |
testcase_09 | AC | 5 ms
6,940 KB |
testcase_10 | AC | 5 ms
6,940 KB |
testcase_11 | AC | 5 ms
6,940 KB |
testcase_12 | AC | 37 ms
6,940 KB |
testcase_13 | AC | 38 ms
6,944 KB |
testcase_14 | AC | 37 ms
6,940 KB |
testcase_15 | AC | 38 ms
6,944 KB |
testcase_16 | AC | 38 ms
6,944 KB |
testcase_17 | AC | 132 ms
6,940 KB |
testcase_18 | AC | 189 ms
6,940 KB |
testcase_19 | AC | 45 ms
6,944 KB |
testcase_20 | AC | 364 ms
6,940 KB |
testcase_21 | AC | 362 ms
6,944 KB |
testcase_22 | AC | 428 ms
6,940 KB |
testcase_23 | AC | 364 ms
6,940 KB |
testcase_24 | AC | 357 ms
6,944 KB |
testcase_25 | AC | 359 ms
6,940 KB |
testcase_26 | WA | - |
testcase_27 | AC | 2 ms
6,940 KB |
testcase_28 | AC | 289 ms
6,940 KB |
testcase_29 | AC | 783 ms
6,940 KB |
testcase_30 | AC | 785 ms
6,944 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
ソースコード
//デバッグ用オプション:-fsanitize=undefined,address //コンパイラ最適化 #pragma GCC optimize("Ofast") //インクルードなど #include<bits/stdc++.h> using namespace std; typedef int ll; //マクロ //forループ //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか //Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる //FORAは範囲for文(使いにくかったら消す) #define REP(i,n) for(ll i=0;i<ll(n);i++) #define REPD(i,n) for(ll i=n-1;i>=0;i--) #define FOR(i,a,b) for(ll i=a;i<=ll(b);i++) #define FORD(i,a,b) for(ll i=a;i>=ll(b);i--) #define FORA(i,I) for(const auto& i:I) //xにはvectorなどのコンテナ #define ALL(x) x.begin(),x.end() #define SIZE(x) ll(x.size()) //定数 #define INF 1000000000000 //10^12:∞ #define MOD 1000000007 //10^9+7:合同式の法 #define MAXR 100000 //10^5:配列の最大のrange //略記 #define PB push_back //挿入 #define MP make_pair //pairのコンストラクタ #define F first //pairの一つ目の要素 #define S second //pairの二つ目の要素 ll check_divisors(ll x,ll y){ ll n=abs(x-y); ll ret=0; FOR(i,1,sqrt(n)){ if(n%i==0){ ll a,b; if(i!=ll(n/i)){ a=i;b=ll(n/i); if((x+y)%(a+2)==0){ if(ll((x+y)/(a+2))%2==b%2){ if(b<ll((x+y)/(a+2)))ret++; //cout<<a<<" "<<b<<" "<<a+2<<" "<<ll((x+y)/(a+2))<<endl; } } a=ll(n/i);b=i; if((x+y)%(a+2)==0){ if(ll((x+y)/(a+2))%2==b%2){ if(b<ll((x+y)/(a+2)))ret++; //cout<<a<<" "<<b<<" "<<a+2<<" "<<ll((x+y)/(a+2))<<endl; } } }else{ a=i;b=i; if(ll((x+y)/(a+2))%2==b%2){ if(b<ll((x+y)/(a+2)))ret++; //cout<<a<<" "<<b<<" "<<a+2<<" "<<ll((x+y)/(a+2))<<endl; } } } } return ret; } signed main(){ //入力の高速化用のコード ios::sync_with_stdio(false); cin.tie(nullptr); ll s;cin>>s; REP(i,s){ ll x,y;cin>>x>>y; if(x==y){ cout<<ll((x+y)/2)-1<<endl; }else{ cout<<check_divisors(x,y)<<endl; } } }