結果

問題 No.2624 Prediction by Average
ユーザー umezoumezo
提出日時 2024-02-10 02:51:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 970 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 2,203 ms
コンパイル使用メモリ 212,636 KB
実行使用メモリ 81,664 KB
最終ジャッジ日時 2024-02-10 02:51:19
合計ジャッジ時間 9,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 969 ms
81,664 KB
testcase_01 AC 958 ms
81,664 KB
testcase_02 AC 931 ms
81,664 KB
testcase_03 AC 970 ms
81,664 KB
testcase_04 AC 969 ms
81,664 KB
testcase_05 AC 964 ms
81,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  vector<set<int>> A(1000);
  for(int i=1;i<=2000;i++){
    for(int j=0;j<i;j++){
      A[1000*j/i].insert(i);
    }
  }
  vector<vector<int>> B(1000);
  rep(i,1000){
    for(auto x:A[i]) B[i].push_back(x);
  }

  int t;
  cin>>t;
  while(t--){
    ll n,a,b;
    char c;
    cin>>n>>a>>c>>b;
    if(b==0) cout<<n<<endl;
    else if(n>2000) cout<<n-2000+(ll)B[b].size()<<endl;
    else cout<<upper_bound(ALL(B[b]),n)-B[b].begin()<<endl;
  }
    
  return 0;
}
0