結果
問題 | No.2324 Two Countries within UEC |
ユーザー |
![]() |
提出日時 | 2023-05-28 13:46:55 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 241 ms / 2,000 ms |
コード長 | 1,528 bytes |
コンパイル時間 | 7,446 ms |
コンパイル使用メモリ | 164,400 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 23:16:25 |
合計ジャッジ時間 | 13,909 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
#include <iostream> #include <vector> #include <set> #include <queue> #include <stack> #include <math.h> #include <cassert> #include <bitset> #include <map> #include <algorithm> #include <iterator> #include <string> #include <utility> #include <numeric> #include <regex> #include <complex> #include <random> #include <atcoder/all> using namespace atcoder; using namespace std; using ll=long long; using ull=unsigned long long; using P=pair<ll,ll>; template<typename T>using minque=priority_queue<T,vector<T>,greater<T>>; template<typename T>bool chmax(T &a,const T &b){return (a<b?(a=b,true):false);} template<typename T>bool chmin(T &a,const T &b){return (a>b?(a=b,true):false);} template<typename T1,typename T2> ostream &operator<<(ostream &os,const pair<T1,T2>&p){ os<<p.first<<" "<<p.second; return os; } template<typename T1,typename T2> istream &operator>>(istream &is,pair<T1,T2>&p){ is>>p.first>>p.second; return is; } template<typename T> istream &operator>>(istream &is,vector<T> &a){ for(auto &i:a)is>>i; return is; } #define reps(i,a,n) for(int i=(a);i<(n);i++) #define rep(i,n) reps(i,0,n) #define all(x) x.begin(),x.end() ll myceil(ll a,ll b){return (a+b-1)/b;} int main(){ int n,m,p,q; cin>>n>>m>>p>>q; modint::set_mod(p); while(q--){ int x,f; cin>>x>>f; if(x%p==0){ if(f==0){ cout<<m<<endl; } else cout<<0<<endl; continue; } modint iv=modint(f)/x; int c=iv.val(); auto ans=m/p; if(m%p>=c&&c!=0)ans++; cout<<ans<<endl; } }