답안 #750239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750239 2023-05-29T08:28:38 Z 7as__7 Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
1000 ms 8020 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
#define all(x) x.begin(),x.end()
const int sz = 1e6 + 1, mod = 1e9 + 7, inf = -1e18;
int dp[10001][1001] = {};
signed main()
{
    int n, k;
    cin >> n >> k;
    vector<int>v(n);
    map<int, pair<int,int>>mp;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        mp[v[i]].first++;
        if(!mp[v[i]].second)
        mp[v[i]].second = i;
    }
    int x = 30 - n;
    int ans = -1;
    int idx = mp[x].second;
    while (1) {
        if (mp[x].first == 1) {
            idx--;
            ans = x;
            break;
        }
        if (mp[x].first == 2) {
            mp[x + 1].second = mp[x].second;
            mp[x + 1].first++;
            x++;
        }
    }
    for (int i = 0; i < n; i++) {
        cout << v[i] << ' ';
        if (idx == i) {
            cout << ans << ' ';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1076 ms 8020 KB Time limit exceeded
2 Execution timed out 1073 ms 8020 KB Time limit exceeded
3 Execution timed out 1077 ms 8020 KB Time limit exceeded
4 Execution timed out 1082 ms 8020 KB Time limit exceeded
5 Execution timed out 1083 ms 8020 KB Time limit exceeded
6 Execution timed out 1076 ms 8020 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 8020 KB Time limit exceeded
2 Execution timed out 1081 ms 8020 KB Time limit exceeded
3 Execution timed out 1086 ms 8020 KB Time limit exceeded
4 Execution timed out 1076 ms 8020 KB Time limit exceeded
5 Execution timed out 1048 ms 8020 KB Time limit exceeded
6 Execution timed out 1073 ms 8020 KB Time limit exceeded
7 Execution timed out 1087 ms 8020 KB Time limit exceeded
8 Execution timed out 1075 ms 8020 KB Time limit exceeded
9 Execution timed out 1084 ms 6484 KB Time limit exceeded
10 Execution timed out 1064 ms 2644 KB Time limit exceeded
11 Execution timed out 1075 ms 4180 KB Time limit exceeded
12 Execution timed out 1072 ms 212 KB Time limit exceeded
13 Execution timed out 1074 ms 212 KB Time limit exceeded
14 Execution timed out 1084 ms 212 KB Time limit exceeded