結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
|
提出日時 | 2025-09-06 13:42:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 542 ms / 2,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 4,209 ms |
コンパイル使用メモリ | 251,352 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-06 13:43:22 |
合計ジャッジ時間 | 19,360 ms |
ジャッジサーバーID (参考情報) |
judge / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; #define all(x) (x).begin(), (x).end() #define oke cout << "Yes" << endl; #define dame cout << "No" << endl; using P = pair<int, int>; int main(){ ll x,y,n; cin>>x>>y>>n; for(ll i=0;i<n;i++){ ll u,v; cin>>u>>v; ll a=u/y; ll b=v/y; if(u%y==0&&u!=0) a--; if(v%y==0&&v!=0) b--; if(a==b){ cout<<abs(u-v)<<endl; } else{ if(u!=0){ u%=y; if(u==0) u+=y; } if(v!=0){ v%=y; if(v==0) v+=y; } cout<<u+v<<endl; } } }