結果

問題 No.2495 Three Sets
ユーザー 蜜蜂蜜蜂
提出日時 2023-10-13 11:21:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,782 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 177,512 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 11:21:39
合計ジャッジ時間 13,177 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 335 ms
4,352 KB
testcase_01 AC 352 ms
4,352 KB
testcase_02 AC 513 ms
4,352 KB
testcase_03 AC 341 ms
4,352 KB
testcase_04 AC 340 ms
4,348 KB
testcase_05 AC 339 ms
4,352 KB
testcase_06 AC 373 ms
4,348 KB
testcase_07 AC 563 ms
4,352 KB
testcase_08 AC 569 ms
4,352 KB
testcase_09 AC 342 ms
4,352 KB
testcase_10 WA -
testcase_11 AC 579 ms
4,352 KB
testcase_12 WA -
testcase_13 AC 589 ms
4,356 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 93 ms
4,352 KB
testcase_19 AC 117 ms
4,352 KB
testcase_20 AC 597 ms
4,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:66:12: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   66 |       auto [sumb,cntb]=v[1][i];
      |            ^
main.cpp:67:12: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   67 |       auto [sumc,cntc]=v[2][j];
      |            ^
main.cpp:80:12: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   80 |       auto [suma,cnta]=v[0][need];
      |            ^

ソースコード

diff #

// g++-13 1.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/dsu>
#include <atcoder/modint>
using namespace atcoder;

using ll = long long;
using ld = long double;
 
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
 
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int na,nb,nc;cin>>na>>nb>>nc;
  vvi cnt(3,vi(7000,0));

  rep(i,0,na){
    int x;cin>>x;
    cnt[0][x+3500]++;
  }
  rep(i,0,nb){
    int x;cin>>x;
    cnt[1][x+3500]++;
  }
  rep(i,0,nc){
    int x;cin>>x;
    cnt[2][x+3500]++;
  }

  vector<vector<pair<ll,int>>> v(3,vector<pair<ll,int>>(7000,{0,0}));

  per(i,6998,0){
    rep(j,0,3){
      v[j][i]=v[j][i+1];
      v[j][i].first+=(ll)cnt[j][i]*(i-3500);
      v[j][i].second+=cnt[j][i];
    }
  }

  ll ans=0;
  rep(i,0,7000){
    rep(j,0,7000){
      // A_i >= - sum(C_i) / |S_B|
      auto [sumb,cntb]=v[1][i];
      auto [sumc,cntc]=v[2][j];

      if(cntb==0){
        ans=max(ans,na*sumc);
        continue;
      }

      ll need=(-sumc+cntb-1)/cntb;
      need+=3500;

      if(need<0)need=0;
      if(6999<=need)need=6999;

      auto [suma,cnta]=v[0][need];

      ans=max(ans,suma*cntb+sumb*cntc+sumc*cnta);
    }
  }

  cout<<ans<<endl;
}
0