結果

問題 No.2203 POWER!!!!!
ユーザー
提出日時 2023-02-03 21:42:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 2,370 bytes
コンパイル時間 3,490 ms
コンパイル使用メモリ 251,104 KB
実行使用メモリ 4,892 KB
最終ジャッジ日時 2023-09-15 17:22:45
合計ジャッジ時間 4,425 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 12 ms
4,376 KB
testcase_10 AC 20 ms
4,380 KB
testcase_11 AC 29 ms
4,380 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 29 ms
4,608 KB
testcase_14 AC 30 ms
4,600 KB
testcase_15 AC 30 ms
4,892 KB
testcase_16 AC 29 ms
4,568 KB
testcase_17 AC 29 ms
4,616 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ull = uint64_t;
using ll = int64_t;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using ld = long double;
using P = pair<ll,ll>;
using G = vector<vector<int>>;

#define LO(...) (void)0
#define debug(x) (void)0

#define reps(i,a,n) for(ll i##_len = (ll)(n), i = (a); i < i##_len; ++i)
#define rep(i,n) reps(i,0,(n))
#define rrep(i,n) reps(i,1,(n)+1)
#define repd(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrepd(i,n) for(ll i=(n);i>=1;i--)

#define inp(i) ll i; cin >> i;
#define inps(s) string s; cin >> s;
#define inpp(p) cin >> (p).first >> (p).second
#define inpv(v,N) vll v(N);rep(i,N)cin>>v[i];
#define inpvs(v,N) vs v(N);rep(i,N)cin>>v[i];
#define all(v) begin(v),end(v)
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define allok(i,N,pred) [&]()->bool{bool allok_=1;rep(i,N)if(!(pred))allok_=0;return allok_;}()
#define anyok(i,N,pred) [&]()->bool{bool anyok_=0;rep(i,N)if(pred)anyok_=1;return anyok_;}()
void YESNO(bool b){cout<<(b?"YES\n":"NO\n");}void yesno(bool b){cout<<(b?"yes\n":"no\n");}void YesNo(bool b){cout<<(b?"Yes\n":"No\n");}

#define SP cout << " "
#define ENDL cout << "\n"
#define setfp cout << fixed << setprecision(16)
template<typename C>void ou(const C&v){cout<<v;}
template<typename C>void ous(const C&v){cout<<v<<" ";}
template<typename C>void oul(const C&v){cout<<v<<"\n";}

template<typename C>void ouv(const C &v){for(auto &&e:v){cout << e;if(&e != &v.back()) cout << ' ';}cout << "\n";}
template<typename C>void ouvadd(const C &v){for(auto &&e:v){cout << e+1;if(&e != &v.back()) cout << ' ';}cout << "\n";}

template<typename T>bool chmax(T &a, const T &b){return a<b?(a=b,1):0;}
template<typename T>bool chmin(T &a, const T &b){return b<a?(a=b,1):0;}

template<typename T>void so(T &a){sort(begin(a),end(a));}
template<typename T,typename C>void so(T &a,C c){sort(begin(a),end(a),c);}
template<typename T>void rso(T &a){sort(rbegin(a),rend(a));}
template<typename T,typename C>void rso(T &a,C c){sort(rbegin(a),rend(a),c);}

constexpr ll INF = 1e18;

ll ipow(ll a, ll b){
    ll r = 1;
    rep(i,b){
        r *= a;
    }
    return r;
}

int main() {
    inp(N);
    inpv(a,N);
    map<ll,ll> s;
    rep(i,N)s[a[i]]++;

    ll ans = 0;
    rep(i,8){
        rep(j,8){
            ans += ipow(i+1,j+1) * s[i+1] * s[j+1];
        }
    }
    oul(ans);
}
0