結果
| 問題 |
No.3260 岩井スターグラフ
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-09-06 13:13:36 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 388 ms / 2,000 ms |
| コード長 | 828 bytes |
| コンパイル時間 | 5,204 ms |
| コンパイル使用メモリ | 335,124 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2025-09-06 13:15:49 |
| 合計ジャッジ時間 | 16,548 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int main() {
FAST_IO
i64 X, Y, N;
cin >> X >> Y >> N;
vector<i64> U(N), V(N);
for (int i = 0; i < N; i++) {
cin >> U[i] >> V[i];
}
for (int i = 0; i < N; i++) {
i64 s1 = (U[i] - 1) / Y;
i64 s2 = (U[i] - 1) % Y;
i64 t1 = (V[i] - 1) / Y;
i64 t2 = (V[i] - 1) % Y;
if (U[i] == 0 || V[i] == 0) {
cout << max(s2, t2) + 1 << endl;
} else if (s1 == t1) {
cout << abs(s2 - t2) << endl;
} else {
cout << s2 + t2 + 2 << endl;
}
}
}
hiromi_ayase