Submission #472804

#TimeUsernameProblemLanguageResultExecution timeMemory
472804Mr_PhDeda (COCI17_deda)C++14
60 / 140
1092 ms3828 KiB
///made by : Mr_Ph :D #include<bits/stdc++.h> #include<unordered_map> typedef long long ll; typedef long long int lli; typedef unsigned long long ull; using namespace std; const double PI=acos(-1.0); const ll mod=(ll)1e9+7; //int dx[4] = {0, 0, 1, -1}; //int dy[4] = {1, -1, 0, 0}; ///the defines :) #define endl '\n' #define vi vector<int> #define vll vector<ll> #define lower(s) transform(s.begin(),s.end(),s.begin(),::tolower) #define upper(s) transform(s.begin(),s.end(),s.begin(),::toupper) #define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i]; #define all(arr) arr.begin(),arr.end() #define allr(arr) arr.rbegin(),arr.rend() #define sz size() ///the end of the defines ;) void solve() { int n,m; cin>>n>>m; vector<int>mp(n+1); for(int i=0;i<m;i++) { char x; cin>>x; if(x=='M') { int a,b; cin>>a>>b; mp[b]=a; } else { int a,b; cin>>a>>b; int done=0; for(int i=b; i<=n; i++) { if(mp[i]<=a&&mp[i]) { cout<<i<<endl; done++; break; } } if(!done) cout<<-1<<endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); //freopen("window.in","r",stdin); //freopen("output.txt","w",stdout); int t=1;//int st; //cin>>t;//cin>>st; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...