Submission #00057
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include<bits/stdc++.h> using namespace std; using Int = long long ; template < typename T1, typename T2> inline void chmin(T1 &a,T2 b){ if (a>b) a=b;} template < typename T1, typename T2> inline void chmax(T1 &a,T2 b){ if (a<b) a=b;} struct FastIO{ FastIO(){ cin.tie(0); ios::sync_with_stdio(0); } }fastio_beet; //INSERT ABOVE HERE signed main(){ Int n; cin>>n; vector<Int> as(n); for (Int i=0;i<n;i++) cin>>as[i]; vector<Int> vs(as); sort(vs.begin(),vs.end()); vector<Int> sm(n+1,0); for (Int i=0;i<n;i++) sm[i+1]=sm[i]+vs[i]; vector<Int> bs(n); for (Int i=0;i<n;i++){ Int k=upper_bound(vs.begin(),vs.end(),as[i])-vs.begin(); bs[i]=sm[n]-sm[k]; } for (Int i=0;i<n;i++){ if (i) cout<< " " ; cout<<bs[i]; } cout<<endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - Sequence Sum |
ユーザー名 | beet |
投稿日時 | 2020-03-02 21:04:08 |
言語 | C++17 |
状態 | Accepted |
得点 | 300 |
ソースコード長 | 823 Byte |
最大実行時間 | 64 ms |
最大メモリ使用量 | 18300 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 300 / 300 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 27 ms | 604 KB |
1
|
in02.txt | AC | 25 ms | 428 KB |
1
|
in03.txt | AC | 16 ms | 488 KB |
1
|
in04.txt | AC | 23 ms | 572 KB |
1
|
in05.txt | AC | 38 ms | 3196 KB |
1
|
in06.txt | AC | 43 ms | 5292 KB |
1
|
in07.txt | AC | 22 ms | 3320 KB |
1
|
in08.txt | AC | 54 ms | 7284 KB |
1
|
in09.txt | AC | 34 ms | 7068 KB |
1
|
in10.txt | AC | 43 ms | 7700 KB |
1
|
in11.txt | AC | 32 ms | 7968 KB |
1
|
in12.txt | AC | 31 ms | 8112 KB |
1
|
in13.txt | AC | 48 ms | 9536 KB |
1
|
in14.txt | AC | 53 ms | 11208 KB |
1
|
in15.txt | AC | 35 ms | 12236 KB |
1
|
in16.txt | AC | 38 ms | 13520 KB |
1
|
in17.txt | AC | 64 ms | 15068 KB |
1
|
in18.txt | AC | 50 ms | 16484 KB |
1
|
in19.txt | AC | 53 ms | 18032 KB |
1
|
in20.txt | AC | 36 ms | 18300 KB |
1
|
in21.txt | AC | 15 ms | 15116 KB |
1
|
in22.txt | AC | 21 ms | 14940 KB |
1
|
sample01.txt | AC | 27 ms | 15156 KB |
1
|
sample02.txt | AC | 19 ms | 15116 KB |
1
|