답안 #992310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992310 2024-06-04T09:09:22 Z ramalzaher Trampoline (info1cup20_trampoline) C++14
컴파일 오류
0 ms 0 KB
x#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(ey  >= sy && ok == 0  )cout<<"Yes\n"; else cout<<"No\n"; 
	}
	
 
 
  return 0;
}

Compilation message

trampoline.cpp:1:2: error: stray '#' in program
    1 | x#include <bits/stdc++.h>
      |  ^
trampoline.cpp:1:1: error: 'x' does not name a type
    1 | x#include <bits/stdc++.h>
      | ^
trampoline.cpp:7:12: error: 'vector' was not declared in this scope
    7 | bool check(vector<int> &a){
      |            ^~~~~~
trampoline.cpp:7:19: error: expected primary-expression before 'int'
    7 | bool check(vector<int> &a){
      |                   ^~~
trampoline.cpp: In function 'int main()':
trampoline.cpp:17:18: error: 'cin' was not declared in this scope
   17 |  int r , c , n ; cin >> r >>c >> n ;
      |                  ^~~
trampoline.cpp:18:2: error: 'map' was not declared in this scope
   18 |  map<int,set<int>>mp;
      |  ^~~
trampoline.cpp:18:6: error: expected primary-expression before 'int'
   18 |  map<int,set<int>>mp;
      |      ^~~
trampoline.cpp:22:3: error: 'mp' was not declared in this scope
   22 |   mp[a].insert(b) ;
      |   ^~
trampoline.cpp:27:3: error: 'vector' was not declared in this scope
   27 |   vector<int> v ; bool ok= 0 ;
      |   ^~~~~~
trampoline.cpp:27:10: error: expected primary-expression before 'int'
   27 |   vector<int> v ; bool ok= 0 ;
      |          ^~~
trampoline.cpp:29:3: error: 'v' was not declared in this scope
   29 |   v.pb(sy);
      |   ^
trampoline.cpp:31:15: error: 'mp' was not declared in this scope
   31 |    auto itt = mp[j].lower_bound(sy) ;
      |               ^~
trampoline.cpp:39:30: error: 'cout' was not declared in this scope
   39 |    if(ey  >= sy && ok == 0  )cout<<"Yes\n"; else cout<<"No\n";
      |                              ^~~~
trampoline.cpp:39:50: error: 'cout' was not declared in this scope
   39 |    if(ey  >= sy && ok == 0  )cout<<"Yes\n"; else cout<<"No\n";
      |                                                  ^~~~