結果
問題 | No.2261 Coffee |
ユーザー |
👑 ![]() |
提出日時 | 2023-04-08 16:39:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 123 ms / 2,000 ms |
コード長 | 1,137 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 79,428 KB |
最終ジャッジ日時 | 2025-02-12 03:54:12 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
#include <iostream>#include <string>#include <vector>#include <algorithm>#include <array>#include <atcoder/modint>using namespace std;using i32 = int;using u32 = unsigned int;using i64 = long long;using u64 = unsigned long long;#define rep(i,n) for(int i=0; i<(int)(n); i++)const i64 INF = 1001001001001001001;using Modint = atcoder::static_modint<998244353>;int main(){int N; cin >> N;vector<i64> L(32, INF);vector<i64> R(32, -INF);vector<array<i64,5>> A(N);rep(i,N) rep(j,5) cin >> A[i][j];rep(i,N){rep(b,32){i64 buf = 0;rep(t,5) buf += A[i][t] * ((b&(1<<t)) ? 1 : -1);L[b] = min(L[b], buf);R[b] = max(R[b], buf);}}rep(i,N){i64 ans = 0;rep(b,32){i64 a = 0;rep(t,5) a += A[i][t] * ((b&(1<<t)) ? 1 : -1);ans = max(ans, max(R[b] - a, a - L[b]));}cout << ans << '\n';}return 0;}struct ios_do_not_sync{ios_do_not_sync(){ios::sync_with_stdio(false);cin.tie(nullptr);}} ios_do_not_sync_instance;