Submission #789156

#TimeUsernameProblemLanguageResultExecution timeMemory
789156DavidAA007Stone Arranging 2 (JOI23_ho_t1)C++14
0 / 100
1 ms340 KiB
#include<bits/stdc++.h> #define mod 1000000007 //#define inf 0x3f3f3f3f //#define int long long #define bit(x,i)(((x)>>(i))&1) #define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; ifstream fin("cablaj.in"); ofstream fout("cablaj.out"); //typedef long long ll; //const long long int mare=1LL*1000000000000000000; const int mare=2e9+5; const int nmax=3e3+5; int T,n,m,k,x,y,c,i,j,t; int suma,maxx,numar,minn,poz,contor,st,dr; vector<pair<int,int>> v; map<int,int>mp; int main() { cin>>n; for(i=1;i<=n;i++) { cin >> x; if(mp[x]) { while(v.size() && v.back().first!=x) { mp[v.back().first]--; v.pop_back(); } } v.push_back({x,i}); mp[x]++; } for(i=0;i<v.size();i++) { if(v[i].first==v[i+1].first) for(j=v[i].second;j<v[i+1].second;j++) cout<<v[i].first<<"\n"; else cout<<v[i].first<<"\n"; } return 0; }

Compilation message (stderr)

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