답안 #577583

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
577583 2022-06-15T05:53:57 Z temporary_juggernaut Roads (CEOI20_roads) C++14
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
#define USING_ORDERED_SET 0
#if USING_ORDERED_SET
#include<bits/extc++.h>
using namespace __gnu_pbds;
template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#endif
template<class T>void umax(T &a,T b){if(a<b)a=b;}
template<class T>void umin(T &a,T b){if(b<a)a=b;}
#ifdef juggernaut
    #define printl(args...) printf(args)
#else
    #define printl(args...) 0
#endif
pair<int,int>a[100005];
pair<int,int>b[100005];
int n;
const int inf=1e9;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d%d%d",&a[i].fr,&a[i].sc,&b[i].fr,&b[i].sc);
	if(a[1].fr==b[1].fr){
		//VERTICAL
		map<int,vector<int>>mp;		
		for(int i=1;i<=n;i++){
			mp[a[i].fr].push_back(a[i].sc);
			mp[a[i].fr].push_back(b[i].sc);
		}
		int prev=inf;
		for(auto &tmp:mp){
			int a=tmp.fr;
			vector<int>&b=tmp.sc;
			sort(b.begin(),b.end());
			for(int i=1;i+1<(int)b.size();i+=2)
				printf("%d %d %d %d\n",a,b[i],a,b[i+1]);
			if(prev^inf){
				printf("%d %d %d %d\n",prev,mp[prev][0],a,b[0]);
				prev=a;
			}
		}
	}else exit(1);
}

Compilation message

roads.cpp: In function 'int main()':
roads.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
roads.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |   scanf("%d%d%d%d",&a[i].fr,&a[i].sc,&b[i].fr,&b[i].sc);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 212 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -