Submission #992038

# Submission time Handle Problem Language Result Execution time Memory
992038 2024-06-03T16:20:21 Z ramalzaher Trampoline (info1cup20_trampoline) C++14
0 / 100
2000 ms 18176 KB
#include <bits/stdc++.h>
#define ll long long  
#define sz size()
#define pb push_back
#define all(x) x.begin() , x.end()
using namespace std;
bool check(vector<int> &a){
	for (int i = 0; i < a.size()-1 ; i++)
	{
		if(a[i] > a[i+1] ) return 0  ; 
	}
	
	return 1 ;
	}
int main()
{
	int r , c , n ; cin >> r >>c >> n ;
	map<int,set<int>>mp; 
	for (int i = 0; i < n; i++)
	{
		int a, b ; cin >> a >> b; 
		mp[a].insert(b) ; 
	}
	int t ; cin >> t; 
	for (int i = 0; i < t; i++)
	{
		vector<int> v ; bool ok= 0 ; 
		int sx , sy  , ex , ey ; cin >> sx >> sy >> ex >> ey; 
		v.pb(sy);
		for(int j = sx ; j <= ex ; j ++ ){
			auto itt = mp[j].lower_bound(sy) ; 
			if(itt==mp[j].end()) { v.pb(-1);ok=1; break ; }
			v.pb(*itt) ; 
			sy = *itt ; 
			//cout<<sy<<" " ; 
			}
			v.pb(ey);
			//for(auto it : v)cout<<it<<" ";//cout<<endl; 
			if(check(v)&&ok==0)cout<<"Yes\n"; else cout<<"No\n"; 
	}
	


  return 0;
}

Compilation message

trampoline.cpp: In function 'bool check(std::vector<int>&)':
trampoline.cpp:8:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |  for (int i = 0; i < a.size()-1 ; i++)
      |                  ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 860 KB expected NO, found YES [27th token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 178 ms 10000 KB expected YES, found NO [1822nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 678 ms 10248 KB expected YES, found NO [4th token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 604 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2099 ms 18176 KB Time limit exceeded
2 Halted 0 ms 0 KB -