結果
| 問題 |
No.3260 岩井スターグラフ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 13:37:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 476 bytes |
| コンパイル時間 | 593 ms |
| コンパイル使用メモリ | 64,152 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:38:01 |
| 合計ジャッジ時間 | 6,013 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int X,Y,N;
cin>>X>>Y>>N;
auto f=[&](long u){
assert(u!=0);
return make_pair((u+Y-1)/Y,(u-1)%Y+1);
};
for(;N--;)
{
long U,V;cin>>U>>V;
if(U==0)
{
auto p=f(V);
cout<<p.second<<"\n";
}
else
{
auto p=f(U);
auto q=f(V);
if(p.first==q.first)cout<<abs(p.second-q.second)<<"\n";
else cout<<p.second+q.second<<"\n";
}
}
}