답안 #1110254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1110254 2024-11-09T03:40:26 Z vjudge1 Card Collection (JOI24_collection) C++17
0 / 100
4000 ms 584 KB
#include<bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pb push_back
using namespace std;
int n,m,a[100005],b[100005];
vector<pair<int,int>> vv;
map<pair<int,int>,bool> mp;

void trau(vector<pair<int,int>>& v)
{
	if(v.size()==1)
	{
		mp[{v[0].fi,v[0].se}]=true;
		return;
	}
	
	for(int i=0;i<=v.size()-2;i++)
	{
		vector<pair<int,int>> u;
		for(int j=0;j<=v.size()-1;j++)
		{
			if(j==i)
			{
				int mina=min(v[j].fi,v[j+1].fi),minb=min(v[j].se,v[j+1].se);
				j++;
				u.push_back({mina,minb});
			}
			else u.push_back(v[j]);
		}
		
		trau(u);
		u.clear();
		
		for(int j=0;j<=v.size()-1;j++)
		{
			if(j==i)
			{
				int maxa=max(v[j].fi,v[j+1].fi),maxb=max(v[j].se,v[j+1].se);
				j++;
				u.push_back({maxa,maxb});
			}
			else u.push_back(v[j]);
		}
		
		trau(u);
		
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
//	freopen(".INP","r",stdin);
//	freopen(".OUT","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
		vv.pb({a[i],b[i]});
	}
	
	trau(vv);
	
	for(int i=1;i<=m;i++)
	{
		int u,v;
		cin>>u>>v;
		if(mp[{u,v}]) cout<<i<<' ';
	}
	return 0;
}

Compilation message

Main.cpp: In function 'void trau(std::vector<std::pair<int, int> >&)':
Main.cpp:19:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0;i<=v.size()-2;i++)
      |              ~^~~~~~~~~~~~
Main.cpp:22:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(int j=0;j<=v.size()-1;j++)
      |               ~^~~~~~~~~~~~
Main.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   for(int j=0;j<=v.size()-1;j++)
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 476 KB Output is correct
2 Correct 1 ms 472 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 25 ms 336 KB Output is correct
8 Correct 407 ms 584 KB Output is correct
9 Execution timed out 4058 ms 456 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 476 KB Output is correct
2 Correct 1 ms 472 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 25 ms 336 KB Output is correct
8 Correct 407 ms 584 KB Output is correct
9 Execution timed out 4058 ms 456 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 476 KB Output is correct
2 Correct 1 ms 472 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 25 ms 336 KB Output is correct
8 Correct 407 ms 584 KB Output is correct
9 Execution timed out 4058 ms 456 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 476 KB Output is correct
2 Correct 1 ms 472 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 336 KB Output is correct
7 Correct 25 ms 336 KB Output is correct
8 Correct 407 ms 584 KB Output is correct
9 Execution timed out 4058 ms 456 KB Time limit exceeded
10 Halted 0 ms 0 KB -