結果
| 問題 |
No.1649 Manhattan Square
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-29 21:44:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 594 bytes |
| コンパイル時間 | 1,129 ms |
| コンパイル使用メモリ | 58,240 KB |
| 最終ジャッジ日時 | 2025-01-23 10:15:54 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 TLE * 36 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%lld%lld", &X[i], &Y[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cmath>
#include <cstdio>
int main() {
int N;
scanf("%d", &N);
long long X[N], Y[N];
for (int i = 0; i < N; i++) {
scanf("%lld%lld", &X[i], &Y[i]);
}
long long ans = 0;
constexpr long long mod = 998244353;
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j < N; j++) {
long long dist = abs(X[i] - X[j]) + abs(Y[i] - Y[j]);
ans += dist * dist;
ans %= mod;
}
}
printf("%lld\n", ans);
}