結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
|
提出日時 | 2025-09-06 15:50:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 1,881 ms |
コンパイル使用メモリ | 193,232 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 15:50:50 |
合計ジャッジ時間 | 6,842 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (ll)(n); i++) #define oke cout << "Yes" << '\n'; #define dame cout << "No" << '\n'; #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() using HaiI = vector<vector<int>>; using Hai2 = vector<vector<ll>>; using HaiB = vector<vector<bool>>; using Hai3 = vector<vector<vector<ll>>>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); ll X,Y,N; cin>>X>>Y>>N; rep(i,N){ ll a,b; cin>>a>>b; if(a==0){ b=(b-1)%Y+1; cout<<a+b<<"\n"; }else if((a-1)/Y == (b-1)/Y){ cout<<abs(a-b)<<"\n"; }else{ a=(a-1)%Y+1; b=(b-1)%Y+1; cout<<a+b<<"\n"; } } }