結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
|
提出日時 | 2025-09-06 13:20:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 349 ms / 2,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 1,824 ms |
コンパイル使用メモリ | 195,244 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 13:20:54 |
合計ジャッジ時間 | 13,025 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll X, Y, N; cin >> X >> Y >> N; while(N--) { ll U, V; cin >> U >> V; if(U == 0) cout << ((V - 1) % Y + 1) << endl; else if(V == 0) cout << ((U - 1) % Y + 1) << endl; else if((U - 1) / Y == (V - 1) / Y) cout << abs(U - V) << endl; else cout << ((U - 1) % Y + 1) + ((V - 1) % Y + 1) << endl; } }