Submission #973030

#TimeUsernameProblemLanguageResultExecution timeMemory
973030vjudge1Deda (COCI17_deda)C++17
60 / 140
22 ms1116 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,q; int a[n+5]; cin>>n>>q; for(int i=0;i<=n;i++){ a[i]=0; } vector<int> v; string s; int x,b; while(q--){ cin>>s>>x>>b; if(s=="M"){ a[b]=x; v.push_back(b); } else{ sort(v.begin(),v.end()); int flag=1; for(int i=0;i<v.size();i++){ if(v[i]>=b){ if(a[v[i]]<=x){ cout<<v[i]<<'\n'; flag=0; break; } } } if(flag){ cout<<"-1\n"; } } } return 0; }

Compilation message (stderr)

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