제출 #654101

#제출 시각아이디문제언어결과실행 시간메모리
654101sofija6Zalmoxis (BOI18_zalmoxis)C++14
30 / 100
1102 ms194848 KiB
#include <bits/stdc++.h> #define ll long long #define MAXN 1000010 using namespace std; map<ll,vector<ll> > m; ll a[MAXN]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,k,x; cin >> n >> k; priority_queue<pair<ll,pair<ll,ll> >,vector<pair<ll,pair<ll,ll> > >,greater<pair<ll,pair<ll,ll> > > > q; for (ll i=1;i<=n;i++) { cin >> a[i]; q.push({a[i],{i,i}}); } while (true) { auto t=q.top(); q.pop(); if (q.empty()) { x=t.first; break; } if (q.top().first!=t.first || q.top().second.first!=t.second.second+1) { m[t.second.second].push_back(t.first); t.first++; q.push(t); k--; continue; } t.second.second=q.top().second.second; q.pop(); t.first++; q.push(t); } if (x!=30) { for (ll i=29;i>=x;i--) { k--; m[n].push_back(i); } } for (ll i=1;i<=n;i++) { cout << a[i] << " "; for (ll j=0;j<m[i].size();j++) { priority_queue<ll> q; q.push(m[i][j]); while (k-- && q.top()) { q.push(q.top()-1); q.push(q.top()-1); q.pop(); } while (!q.empty()) { cout << q.top() << " "; q.pop(); } } } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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