結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
![]() |
提出日時 | 2025-09-06 17:47:52 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 552 ms / 2,000 ms |
コード長 | 921 bytes |
コンパイル時間 | 3,334 ms |
コンパイル使用メモリ | 272,268 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 17:48:11 |
合計ジャッジ時間 | 18,524 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define debug(x) cerr << #x << " = " << (x) << "\n" #else #define debug(x) void(0) #endif typedef long long ll; typedef long double ld; typedef pair<int, int> Pii; typedef pair<ll, ll> Pll; template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (int i = 0; i < (int)v.size(); i++) os << v[i] << (i + 1 == (int)v.size() ? "" : " "); return os; } template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (int i = 0; i < (int)v.size(); i++) is >> v[i]; return is; } //////////////////////////////////////////////////////////// int main() { int X, Y, N; cin >> X >> Y >> N; while (N--) { ll U, V; cin >> U >> V; if (U == 0) cout << (V - 1) % Y + 1 << "\n"; else if ((U - 1) / Y == (V - 1) / Y) cout << V - U << "\n"; else cout << (U - 1) % Y + (V - 1) % Y + 2 << "\n"; } return 0; }