結果

問題 No.3260 岩井スターグラフ
ユーザー zutpig
提出日時 2025-09-06 13:37:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 4,130 ms
コンパイル使用メモリ 251,344 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-06 13:37:51
合計ジャッジ時間 18,351 ms
ジャッジサーバーID
(参考情報)
judge / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#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%3==0&&u!=0) a--;
  if(v%3==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;
    
  }
}

}



0