Submission #668388

#TimeUsernameProblemLanguageResultExecution timeMemory
668388RifalZalmoxis (BOI18_zalmoxis)C++14
35 / 100
153 ms7024 KiB
#include <bits/stdc++.h> //#include <fstream> #define endl '\n' #define mod 5000000 #define INF 100000000000000000 //define ll long long //ofstream fout("split.out"); //ifstream fin("split.in"); //#define cin fin //#define cout fout #define fi first #define se second using namespace std; int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, k ;cin >> n >> k; vector<int> v; stack<int> st; for(int i = 0; i < n; i++) { int x; cin >> x; while(!st.empty() && st.top() < x) { int z = st.top(); v.push_back(z); while(z == st.top()) { st.pop(); z++; } st.push(z); } st.push(x); v.push_back(x); int y = st.top(); st.pop(); while(!st.empty() && st.top() == y) { st.pop(); y++; } if(y < 30) st.push(y); } while(!st.empty() && st.top() != 30) { int y = st.top(); st.pop(); v.push_back(y); y++; while(!st.empty() && st.top()== y) { st.pop(); y++; } if(y != 30) st.push(y); } for(int i = 0; i < v.size(); i++) { cout << v[i] << ' '; } return 0; }

Compilation message (stderr)

zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:49:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(int i = 0; i < v.size(); i++) {
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...