結果
| 問題 | No.2324 Two Countries within UEC |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 15:28:29 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 936 bytes |
| 記録 | |
| コンパイル時間 | 2,996 ms |
| コンパイル使用メモリ | 273,364 KB |
| 実行使用メモリ | 16,896 KB |
| 最終ジャッジ日時 | 2026-06-30 23:35:29 |
| 合計ジャッジ時間 | 10,138 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 40 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using mint = modint998244353;
constexpr ll INF = 1ll << 60;
template<typename T, typename D> void printelem(const T& container, const D& divide){
for(const auto& i : container) cout << i << divide;
cout << endl;
}
template<typename T> void printelem(const T& container) { printelem(container, ", "); }
int main(){
//インプット
ll N, M, P, Q;
cin >> N >> M >> P >> Q;
for(ll q = 0; q < Q; q++){
ll x, f;
cin >> x >> f;
ll first = -1;
for(ll i = x; i <= x*M; i += x){
if(i % P == f){
first = i;
break;
}
}
// ll ans = 0;
// for(ll i = first; i <= x*M; i += x*P){
// ans++;
// }
// if(first > 0) cout << ans << endl;
// else cout << 0 << endl;
if(first > 0) cout << (x*M-first)/(x*P) + 1 << endl;
else cout << 0 << endl;
}
return 0;
}