# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
827416 | 2023-08-16T12:56:12 Z | vjudge1 | Zalmoxis (BOI18_zalmoxis) | C++17 | 128 ms | 10364 KB |
/* */ #include<iostream> #include<vector> #include<iomanip> #include<algorithm> #include<map> #include<set> #include<climits> #include<numeric> #include<queue> #include<unordered_map> #include<string> #include<climits> #include<unordered_set> #include<bitset> #include<cstring> #include<cmath> #include<stack> #include<tuple> #if 1 #define pb push_back #define endl '\n' #define fio ios_base::sync_with_stdio(false);cin.tie(NULL); #define CDIV(a,b) (((a)+(b)-(1))/(b)) using namespace std; typedef long long lint; typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<vi> vivi; typedef pair<char,int> pci; typedef vector<bool> vb; typedef long double ld; const int inf = 1e17 + 5; const int mod = 1e9 + 7; const int N = 1e6; #endif void fileio(string s = "test"){ #ifndef ONLINE_JUDGE freopen((s+string(".in")).c_str(),"r",stdin); freopen((s+string(".out")).c_str(),"w",stdout); #endif } int mod_(int a, int b) { if(a >= 0)return a % b; a += (-a/b + 1) * b; return a % b; } /* 1. CHECK IF THE ANSWER IS MODULO M DAMMIT 2. Edge cases 3. Check for overflow (maybe before edge cases idk) 24. Use the number 24 (it automatically makes everything turn to ac) */ void solve(){ int n, k; cin >> n >> k; vi v(n); for(int& i : v)cin >> i; if(n == 1) { cout << v[0] << ' ' << v[0] << endl; return; } int mn = *min_element(v.begin(), v.end()); int need = v.back(); bool first = true; vi ans; for(int i = n - 1; i >= 0; --i) { if(v[i] == mn ) { if(first) { first = false; need = mn; ans.pb(v[i]); continue; } else { first = true; } } if(v[i] != need) { //cout << i << ' ' << need << endl; ans.push_back(v[i]); ans.push_back(need); for(int j = i - 1; j >= 0; --j)ans.push_back(v[j]); break; } else { ans.pb(v[i]); need = v[i] + 1; } } reverse(ans.begin(), ans.end()); for(int& i : ans)cout << i << ' ';cout << endl; } signed main(){ fio; //int t;cin >> t;while(t--) solve(); } /* */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 108 ms | 10300 KB | not a zalsequence |
2 | Incorrect | 90 ms | 10352 KB | not a zalsequence |
3 | Correct | 91 ms | 10308 KB | Output is correct |
4 | Incorrect | 128 ms | 10356 KB | not a zalsequence |
5 | Incorrect | 103 ms | 10364 KB | not a zalsequence |
6 | Incorrect | 92 ms | 10352 KB | not a zalsequence |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 90 ms | 10356 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 100 ms | 10364 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 114 ms | 10336 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 100 ms | 10364 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 95 ms | 10360 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 97 ms | 10260 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 106 ms | 10312 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 100 ms | 10364 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 83 ms | 8312 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 41 ms | 3680 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 49 ms | 5376 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 1 ms | 212 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 0 ms | 212 KB | Unexpected end of file - int32 expected |