結果

問題 No.1470 Mex Sum
ユーザー subarusubaru
提出日時 2021-04-09 22:18:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,019 bytes
コンパイル時間 2,003 ms
コンパイル使用メモリ 199,396 KB
実行使用メモリ 8,476 KB
最終ジャッジ日時 2023-09-07 11:43:04
合計ジャッジ時間 18,307 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,312 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1,132 ms
4,384 KB
testcase_03 AC 1,147 ms
4,384 KB
testcase_04 AC 1,207 ms
4,376 KB
testcase_05 AC 1,161 ms
4,380 KB
testcase_06 AC 1,232 ms
4,380 KB
testcase_07 AC 1,187 ms
4,380 KB
testcase_08 AC 1,203 ms
4,376 KB
testcase_09 AC 1,235 ms
4,384 KB
testcase_10 AC 1,231 ms
4,376 KB
testcase_11 AC 1,165 ms
4,376 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<VI>;
using VVL = vector<VL>;
using VS = vector<string>;
using VC = vector<char>;
using Q = queue<int>;
using P = pair<int, int>;
using llP = pair<ll, ll>;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

void _print(ostream&){}
template<class T,class...U>
void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>
void out(const T&...t){_print(cout,t...);}
template<class...T>
void err(const T&...t){_print(cerr,t...);}
#define strictout(x, precision) cout<<fixed<<setprecision(precision)<<(x)<<endl

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define repa(j, i, n) for (int j=i; j<n; j++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define F first
#define S second
template<class T, class U>bool chmax(T&a,const U&b){bool x=a<b;x?a=b:b;return x;}template<class T, class U>bool chmin(T&a,const U&b){bool x=a>b;x?a=b:b;return x;}
template<class T, class U>auto max(const T&a,const U&b){return a<b?b:a;}template<class T, class U>auto min(const T&a,const U&b){return a<b?a:b;}

#define max5 100010
#define max9 1000000010
#define max10 10000000010

#define YesNo(x) cout<<(x?"Yes":"No")<<endl
#define YESNO(x) cout<<(x?"YES":"NO")<<endl
#define yesno(x) cout<<(x?"yes":"no")<<endl
#define yay(x) cout<<(x?"yay":":(")<<endl

#define deg(_rad) (((_rad)/2/M_PI)*360)
#define rad(_deg) (((_deg)/360)*2*M_PI)
#define mid(min, max) ((min + max) / 2)

int mex(int i, int j) {
  repp(ans, 3){
    if (ans == i || ans == j) continue;
    return ans;
  }
  return 4;
}

int main() {
  in(n);
  VI a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;

  rep(i, n-1){
    repa(j, i+1, n) {
      ans += mex(a[i], a[j]);
    }
  }

  out(ans);

  return 0;
}
0