結果
問題 | No.2261 Coffee |
ユーザー |
![]() |
提出日時 | 2023-04-07 22:03:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 156 ms / 2,000 ms |
コード長 | 1,104 bytes |
コンパイル時間 | 1,904 ms |
コンパイル使用メモリ | 171,912 KB |
実行使用メモリ | 39,168 KB |
最終ジャッジ日時 | 2024-10-02 19:33:14 |
合計ジャッジ時間 | 7,525 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using P = pair<ll,ll>;#define fix(x) fixed << setprecision(x)#define asc(x) x, vector<x>, greater<x>#define rep(i, n) for(ll i = 0; i < n; i++)#define all(x) (x).begin(),(x).end()template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}constexpr ll INFLL = (1LL << 62), MOD = 998244353;constexpr int INF = (1 << 30);int main(){cin.tie(nullptr);ios::sync_with_stdio(false);int n;cin >> n;vector<vector<ll>> a(n,vector<ll>(5)), x(n,vector<ll>(1<<5,0));vector<ll> ma(1<<5, -INFLL), mi(1<<5, INFLL);rep(i,n){rep(j,5) cin >> a[i][j];rep(j,1<<5){rep(k,5) x[i][j] += a[i][k] * (1 - ((j>>k)&1)*2);chmin(mi[j], x[i][j]);chmax(ma[j], x[i][j]);}}rep(i,n){ll ans = 0;rep(j,1<<5) chmax(ans, abs(x[i][j]-ma[j]));rep(j,1<<5) chmax(ans, abs(x[i][j]-mi[j]));cout << ans << '\n';}return 0;}