提出 #25428642
ソースコード 拡げる
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(var) (var).begin(), (var).end()
#define sz(x) (int)x.size()
#define MAXX 9000000000000000000
template <typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
template <typename T> void debug_out(string s, T t) { cout << "[" << s << ": " << t << "]\n"; }
template <typename T, typename... U> void debug_out(string s, T t, U... u) { int w = 0, c = 0; while(w < (int)s.size()) { if(s[w] == '(') c++; if(s[w] == ')') c--; if(!c and s[w] == ',') break; w++; } cout << "[" << s.substr(0, w) << ": " << t << "] "; debug_out(s.substr(w+2, (int)s.size()-w-1), u...); }
#define DEBUG
#ifdef DEBUG
#define dbg(Z...) debug_out(#Z, Z)
#else
#define dbg(Z...)
#endif
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
multiset<int, greater<int>> nos;
cin >> n >> m;
for(int i=0;i<n;i++)
{
int x;
cin >> x;
nos.insert(x);
}
int ans = 0;
while(m--)
{
int pp = *nos.begin();
if(!pp) break;
nos.erase(nos.begin());
ans += pp;
pp--;
nos.insert(pp);
}
cout << ans;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - Amusement Park |
| ユーザ | KahanHai |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 0 |
| コード長 | 1786 Byte |
| 結果 | TLE |
| 実行時間 | 2206 ms |
| メモリ | 8296 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 500 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, example0.txt, example1.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 000.txt | AC | 8 ms | 3608 KiB |
| 001.txt | AC | 4 ms | 3548 KiB |
| 002.txt | TLE | 2205 ms | 3368 KiB |
| 003.txt | TLE | 2205 ms | 3312 KiB |
| 004.txt | TLE | 2205 ms | 3332 KiB |
| 005.txt | TLE | 2205 ms | 3260 KiB |
| 006.txt | TLE | 2205 ms | 3344 KiB |
| 007.txt | TLE | 2205 ms | 3332 KiB |
| 008.txt | AC | 47 ms | 8296 KiB |
| 009.txt | AC | 50 ms | 8160 KiB |
| 010.txt | TLE | 2205 ms | 7856 KiB |
| 011.txt | TLE | 2205 ms | 8004 KiB |
| 012.txt | TLE | 2205 ms | 7852 KiB |
| 013.txt | TLE | 2205 ms | 7984 KiB |
| 014.txt | TLE | 2205 ms | 7864 KiB |
| 015.txt | TLE | 2205 ms | 7868 KiB |
| 016.txt | AC | 10 ms | 3636 KiB |
| 017.txt | AC | 4 ms | 3608 KiB |
| 018.txt | AC | 5 ms | 3632 KiB |
| 019.txt | AC | 3 ms | 3656 KiB |
| 020.txt | TLE | 2205 ms | 3272 KiB |
| 021.txt | TLE | 2205 ms | 3328 KiB |
| 022.txt | AC | 37 ms | 8264 KiB |
| 023.txt | AC | 42 ms | 8196 KiB |
| 024.txt | AC | 35 ms | 8224 KiB |
| 025.txt | AC | 44 ms | 8248 KiB |
| 026.txt | TLE | 2206 ms | 7932 KiB |
| 027.txt | TLE | 2206 ms | 8024 KiB |
| 028.txt | TLE | 2206 ms | 8000 KiB |
| 029.txt | TLE | 2205 ms | 7960 KiB |
| 030.txt | TLE | 2205 ms | 7868 KiB |
| 031.txt | TLE | 2206 ms | 8020 KiB |
| 032.txt | TLE | 2206 ms | 8032 KiB |
| 033.txt | AC | 8 ms | 3512 KiB |
| 034.txt | AC | 2 ms | 3468 KiB |
| 035.txt | AC | 2 ms | 3528 KiB |
| 036.txt | AC | 2 ms | 3612 KiB |
| 037.txt | TLE | 2205 ms | 3396 KiB |
| 038.txt | TLE | 2205 ms | 3364 KiB |
| 039.txt | TLE | 2205 ms | 3344 KiB |
| 040.txt | TLE | 2205 ms | 7996 KiB |
| 041.txt | TLE | 2205 ms | 7900 KiB |
| 042.txt | TLE | 2206 ms | 7924 KiB |
| 043.txt | TLE | 2205 ms | 7852 KiB |
| 044.txt | TLE | 2205 ms | 8032 KiB |
| 045.txt | TLE | 2205 ms | 8028 KiB |
| 046.txt | TLE | 2205 ms | 7988 KiB |
| 047.txt | TLE | 2205 ms | 8000 KiB |
| 048.txt | TLE | 2205 ms | 8004 KiB |
| 049.txt | TLE | 2205 ms | 8004 KiB |
| example0.txt | AC | 6 ms | 3564 KiB |
| example1.txt | AC | 2 ms | 3516 KiB |