結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
|
提出日時 | 2020-04-24 21:51:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 2,608 ms |
コンパイル使用メモリ | 190,944 KB |
最終ジャッジ日時 | 2025-01-09 23:33:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | int q; scanf("%d",&q); | ~~~~~^~~~~~~~~ main.cpp:11:35: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int n,i0,j0; scanf("%d%d%d",&n,&i0,&j0); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; int main(){ int q; scanf("%d",&q); rep(_,q){ int n,i0,j0; scanf("%d%d%d",&n,&i0,&j0); lint d=min({i0,n-i0-1,j0,n-j0-1}); lint ans=4*d*(n-d); if (d==i0) ans+=j0-d; else if(d==n-j0-1) ans+=(n-2*d-1)+(i0-d); else if(d==n-i0-1) ans+=2*(n-2*d-1)+(n-d-j0-1); else ans+=3*(n-2*d-1)+(n-d-i0-1); printf("%lld\n",ans); } return 0; }