結果
問題 | No.1034 テスターのふっぴーさん |
ユーザー |
|
提出日時 | 2020-04-24 21:32:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,025 bytes |
コンパイル時間 | 2,023 ms |
コンパイル使用メモリ | 191,388 KB |
最終ジャッジ日時 | 2025-01-09 23:16:21 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | int tq; scanf("%d", &tq); | ~~~~~^~~~~~~~~~~ main.cpp:28:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | ll n, y, x; scanf("%lld%lld%lld", &n, &y, &x); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i, n) FOR(i, 0, (n)) #define FOR(i, a, b) for(int i=(a); i<(b); i++) #define LAR(a, b) ((a)=max((a),(b))) #define SML(a, b) ((a)=min((a),(b))) using ll = long long; using ld = long double; using vi = vector<int>; using vl = vector<ll>; using pii = pair<int, int>; using vpii = vector<pair<int, int>>; template<typename T> using pque = priority_queue<T, vector<T>, greater<T>>; #define PB push_back #define EB emplace_back #define MP make_pair #define ALL(a) (a).begin(), (a).end() #ifdef LOCAL_DEBUG #define DEBUG(...) printf(__VA_ARGS__) #else #define DEBUG(...) #endif int main(){ int tq; scanf("%d", &tq); REP(iq, tq){ ll n, y, x; scanf("%lld%lld%lld", &n, &y, &x); ll a = min({y, n-1-y, x, n-1-x}); ll b = n-2*a-1, c = n-1-a; ll ans = 4*(n-1)*a - 4*a*(a-1); if(y == a) { ans += b * 0 + x-a; } else if(x == c){ ans += b * 1 + y-a; } else if(y == c){ ans += b * 2 + c-x; } else { ans += b * 3 + c-y; } printf("%lld\n", ans); } }