結果
問題 | No.2261 Coffee |
ユーザー | 2bit |
提出日時 | 2023-06-08 11:42:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 487 ms / 2,000 ms |
コード長 | 5,763 bytes |
コンパイル時間 | 2,296 ms |
コンパイル使用メモリ | 212,560 KB |
実行使用メモリ | 58,032 KB |
最終ジャッジ日時 | 2024-06-09 19:42:25 |
合計ジャッジ時間 | 15,966 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 3 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,940 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 3 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,944 KB |
testcase_08 | AC | 3 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 3 ms
6,940 KB |
testcase_11 | AC | 3 ms
6,940 KB |
testcase_12 | AC | 3 ms
6,944 KB |
testcase_13 | AC | 3 ms
6,944 KB |
testcase_14 | AC | 3 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 2 ms
6,944 KB |
testcase_17 | AC | 15 ms
6,940 KB |
testcase_18 | AC | 14 ms
6,940 KB |
testcase_19 | AC | 13 ms
6,944 KB |
testcase_20 | AC | 10 ms
6,944 KB |
testcase_21 | AC | 13 ms
6,944 KB |
testcase_22 | AC | 10 ms
6,940 KB |
testcase_23 | AC | 18 ms
6,940 KB |
testcase_24 | AC | 441 ms
54,040 KB |
testcase_25 | AC | 362 ms
46,828 KB |
testcase_26 | AC | 485 ms
57,592 KB |
testcase_27 | AC | 425 ms
53,488 KB |
testcase_28 | AC | 292 ms
48,892 KB |
testcase_29 | AC | 285 ms
47,968 KB |
testcase_30 | AC | 218 ms
38,180 KB |
testcase_31 | AC | 359 ms
58,028 KB |
testcase_32 | AC | 362 ms
57,904 KB |
testcase_33 | AC | 374 ms
57,976 KB |
testcase_34 | AC | 371 ms
57,908 KB |
testcase_35 | AC | 378 ms
57,904 KB |
testcase_36 | AC | 367 ms
57,904 KB |
testcase_37 | AC | 369 ms
57,900 KB |
testcase_38 | AC | 461 ms
57,900 KB |
testcase_39 | AC | 487 ms
57,904 KB |
testcase_40 | AC | 470 ms
57,908 KB |
testcase_41 | AC | 486 ms
57,904 KB |
testcase_42 | AC | 467 ms
58,032 KB |
testcase_43 | AC | 466 ms
57,900 KB |
testcase_44 | AC | 466 ms
57,908 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() #define eb emplace_back using namespace std; using ll = long long; using ld = long double; using vl = vector<long long>; using vvl = vector<vector<long long>>; using vs = vector<string>; using pl = pair<long long, long long>; template <typename T> inline bool chmin(T& a, const T& b) {bool compare = a > b; if (a > b) a = b; return compare;} template <typename T> inline bool chmax(T& a, const T& b) {bool compare = a < b; if (a < b) a = b; return compare;} template<class T>using rp_queue=priority_queue<T,vector<T>,greater<T>>; template <typename T> T gcd(T a, T b) {if (b == 0)return a; else return gcd(b, a % b);} template <typename T> inline T lcm(T a, T b) {return a /gcd(a, b)*b;} const ld PI = acos(-1); void yes(){cout<<"Yes"<<endl;} void no(){cout<<"No"<<endl;} void yesno(bool f){if(f)yes();else no();} template <class OStream, class T> OStream &operator<<(OStream &os, const std::vector<T> &vec); template <class OStream, class T, size_t sz> OStream &operator<<(OStream &os, const std::array<T, sz> &arr); template <class OStream, class T, class TH> OStream &operator<<(OStream &os, const std::unordered_set<T, TH> &vec); template <class OStream, class T, class U> OStream &operator<<(OStream &os, const pair<T, U> &pa); template <class OStream, class T> OStream &operator<<(OStream &os, const std::deque<T> &vec); template <class OStream, class T> OStream &operator<<(OStream &os, const std::set<T> &vec); template <class OStream, class T> OStream &operator<<(OStream &os, const std::multiset<T> &vec); template <class OStream, class T> OStream &operator<<(OStream &os, const std::unordered_multiset<T> &vec); template <class OStream, class T, class U> OStream &operator<<(OStream &os, const std::pair<T, U> &pa); template <class OStream, class TK, class TV> OStream &operator<<(OStream &os, const std::map<TK, TV> &mp); template <class OStream, class TK, class TV, class TH> OStream &operator<<(OStream &os, const std::unordered_map<TK, TV, TH> &mp); template <class OStream, class... T> OStream &operator<<(OStream &os, const std::tuple<T...> &tpl); template <class OStream, class T> OStream &operator<<(OStream &os, const std::vector<T> &vec) { os << '['; for (auto v : vec) os << v << ','; os << ']'; return os; } template <class OStream, class T, size_t sz> OStream &operator<<(OStream &os, const std::array<T, sz> &arr) { os << '['; for (auto v : arr) os << v << ','; os << ']'; return os; } template <class... T> std::istream &operator>>(std::istream &is, std::tuple<T...> &tpl) { std::apply([&is](auto &&... args) { ((is >> args), ...);}, tpl); return is; } template <class OStream, class... T> OStream &operator<<(OStream &os, const std::tuple<T...> &tpl) { os << '('; std::apply([&os](auto &&... args) { ((os << args << ','), ...);}, tpl); return os << ')'; } template <class OStream, class T, class TH> OStream &operator<<(OStream &os, const std::unordered_set<T, TH> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; } template <class OStream, class T> OStream &operator<<(OStream &os, const std::deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ','; os << ']'; return os; } template <class OStream, class T> OStream &operator<<(OStream &os, const std::set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; } template <class OStream, class T> OStream &operator<<(OStream &os, const std::multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; } template <class OStream, class T> OStream &operator<<(OStream &os, const std::unordered_multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; } template <class OStream, class T, class U> OStream &operator<<(OStream &os, const std::pair<T, U> &pa) { return os << '(' << pa.first << ',' << pa.second << ')'; } template <class OStream, class TK, class TV> OStream &operator<<(OStream &os, const std::map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; } template <class OStream, class TK, class TV, class TH> OStream &operator<<(OStream &os, const std::unordered_map<TK, TV, TH> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; } #ifdef LOCAL const string COLOR_RESET = "\033[0m", BRIGHT_GREEN = "\033[1;32m", BRIGHT_RED = "\033[1;31m", BRIGHT_CYAN = "\033[1;36m", NORMAL_CROSSED = "\033[0;9;37m", RED_BACKGROUND = "\033[1;41m", NORMAL_FAINT = "\033[0;2m"; #define dbg(x) std::cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << ") " << __FILE__ << COLOR_RESET << std::endl #define dbgif(cond, x) ((cond) ? std::cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << ") " << __FILE__ << COLOR_RESET << std::endl : std::cerr) #else #define dbg(x) ((void)0) #define dbgif(cond, x) ((void)0) #endif void solve(){ int N;cin>>N; vvl A(5,vl(N)); rep(i,N){ rep(j,5){ cin>>A[j][i]; } } vvl D(1LL<<5,vl(N)); rep(i,(1LL<<5)){ vl d(5,1); rep(j,5){ if(i&(1LL<<j)){ d[j]*=-1; } } rep(j,N){ rep(k,5){ D[i][j] += d[k]*A[k][j]; } } } vvl D2 = D; rep(i,(1LL<<5))sort(all(D2[i])); rep(i,N){ ll ans = 0; rep(j,(1LL<<5)){ chmax(ans,abs(D[j][i]-D2[j].front())); chmax(ans,abs(D[j][i]-D2[j].back())); } cout<<ans<<endl; } } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout<<fixed<<setprecision(15); int num_tc = 1; //cin >> num_tc; rep(tc,num_tc){ // cout << "Case #" << tc+1 << "OK" << endl; solve(); } }