結果

問題 No.3260 岩井スターグラフ
ユーザー karinohito
提出日時 2025-09-06 15:12:51
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 3,249 ms
コンパイル使用メモリ 272,660 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-09-06 15:13:00
合計ジャッジ時間 8,781 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll X,Y,N;
    cin>>X>>Y>>N;
    for(int i=0;i<N;i++){
        ll U,V;
        cin>>U>>V;
        U--;V--;
        if(U/Y==V/Y){
            cout<<abs(U-V)<<"\n";
        }
        else{
            cout<<(U!=-1?(U%Y)+1:0)+(V!=-1?(V%Y)+1:0)<<"\n";
        }
    }
} 

0