Submission #472874

# Submission time Handle Problem Language Result Execution time Memory
472874 2021-09-14T12:33:02 Z Mr_OK_Man Deda (COCI17_deda) C++17
80 / 140
1000 ms 1316 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
  //  cout << "Hello world!" << endl;
  long long n,q;
  cin>>n>>q;
 vector<pair<long long,long long>>v;
  while(q--)
  {
      char w;
      cin>>w;
      if(w=='M')
      {
          long long x,a;
          cin>>x>>a;
          v.push_back({a,x});//LESS STORAGE BUT MORE TIME (LOGN)?
      }
      else
      {
          long long y,b;
          cin>>y>>b;
          long long f=1e18;
          for(int i=0;i<v.size();i++)
          {
              if(v[i].first>=b&&v[i].second<=y)
              {
              f=min(f,v[i].first);
              }
          }
          if(f>=1e18)
          {
              cout<<-1<<endl;
          }else
          cout<<f<<endl;
//LOL IF IT WORKED BTW
      }
  }
    return 0;
}

Compilation message

deda.cpp: In function 'int main()':
deda.cpp:26:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |           for(int i=0;i<v.size();i++)
      |                       ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 19 ms 312 KB Output is correct
4 Correct 646 ms 1316 KB Output is correct
5 Execution timed out 1090 ms 796 KB Time limit exceeded
6 Execution timed out 1096 ms 808 KB Time limit exceeded
7 Execution timed out 1093 ms 888 KB Time limit exceeded