Submission #916488

#TimeUsernameProblemLanguageResultExecution timeMemory
916488hsuanxs111Stone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
208 ms20160 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl '\n' signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; vector<int> v(n),ans; map<int,int> mp; for(int i=0;i<n;i++){ cin>>v[i]; mp[v[i]]=i; } for(int i=0;i<n;i++){ ans.push_back(i); i=mp[v[i]]; } ans.push_back(n); for(int i=0;i<ans.size()-1;i++){ for(int j=ans[i];j<ans[i+1];j++){ cout<<v[ans[i]]<<endl; } } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:25:18: 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]
   25 |     for(int i=0;i<ans.size()-1;i++){
      |                 ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...