Submission #00080
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include<bits/stdc++.h> using namespace std; int main(){ int w,h,n; int x[10001],y[10001]; cin>>w>>h>>n; for ( int i=0;i<n;i++){ cin>>x[i]>>y[i]; } int ans=0; int nowx=x[0],nowy=y[0]; int i=1; while (i<n){ while (nowx<x[i] && nowy<y[i]){ nowx++;nowy++; ans++; } while (nowx>x[i] && nowy>y[i]){ nowx--;nowy--; ans++; } ans+= abs (nowx-x[i])+ abs (nowy-y[i]); nowx=x[i]; nowy=y[i]; i++; } cout<<ans<<endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0005 - 超都観光 (Super Metropolis) |
ユーザー名 | ei1437 |
投稿日時 | 2015-11-12 17:58:50 |
言語 | C++11 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 548 Byte |
最大実行時間 | 18 ms |
最大メモリ使用量 | 588 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | in1 | 20 / 20 | *1.txt |
2 | in2 | 20 / 20 | *[12].txt |
3 | in3 | 20 / 20 | *[1-3].txt |
4 | in4 | 20 / 20 | *[1-4].txt |
5 | in5 | 20 / 20 | *[1-5].txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2014-yo-t3-in1.txt | AC | 18 ms | 476 KB |
1
|
2
|
3
|
4
|
5
|
2014-yo-t3-in2.txt | AC | 9 ms | 440 KB |
2
|
3
|
4
|
5
|
|
2014-yo-t3-in3.txt | AC | 11 ms | 532 KB |
3
|
4
|
5
|
||
2014-yo-t3-in4.txt | AC | 14 ms | 496 KB |
4
|
5
|
|||
2014-yo-t3-in5.txt | AC | 14 ms | 588 KB |
5
|