結果
問題 | No.1470 Mex Sum |
ユーザー |
|
提出日時 | 2021-04-09 22:18:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,019 bytes |
コンパイル時間 | 2,081 ms |
コンパイル使用メモリ | 194,676 KB |
最終ジャッジ日時 | 2025-01-20 14:37:13 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 TLE * 39 |
ソースコード
#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; }