You are viewing a single comment's thread. Return to all comments →
code using maps i think its simple to understand
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--){ int n,m; cin>>m>>n; vector<int>v(n); map<int,int>maps; for(int i=0;i<n;i++){ cin>>v[i]; if(maps.find(v[i])!=maps.end()){ cout<<maps[v[i]]+1<<" "<<i+1<<endl; } maps[m-v[i]]=i; } } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
code using maps i think its simple to understand