답안 #248993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
248993 2020-07-13T22:21:30 Z blacktulip Norela (info1cup18_norela) C++17
20 / 100
800 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 65;
const lo mod = 1000000007;

int n,m,b[li],a[li][li],k,flag,t,no[li],l[li];
int cev;
string s;
vector<int> mini;

inline void f(int sira,int mask){
	if(sira>m){
		for(int i=1;i<=n;i++)no[i]=0;
		for(int i=0;i<m;i++){
			if((mask&(1<<i))==0)continue;
			for(int j=1;j<=l[i];j++){
				no[a[i][j]]++;
			}
		}
		flag=0;
		FOR{
			if(no[i]%2==0)flag=1;
		}
		vector<int> v;
		if(flag==1)return ;
		for(int i=0;i<m;i++){
			if((mask&(1<<i))==0)continue;
			v.pb(i+1);
		}
		sort(v.begin(),v.end());
		if((int)v.size()<(int)mini.size()){mini=v;return ;}
		if((int)v.size()>(int)mini.size()){return ;}
		if(mini>v)mini=v;
		return ;
	}
	f(sira+1,mask);
	f(sira+1,(mask|(1<<sira)));
}

int main(void){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)mini.pb(1000000);
	for(int i=0;i<m;i++){
		scanf("%d",&l[i]);
		for(int j=1;j<=l[i];j++)scanf("%d",&a[i][j]);
	}
	f(0,0);
	printf("%d\n",(int)mini.size());
	for(int i=0;i<(int)mini.size();i++){
		printf("%d ",mini[i]);
	}
	return 0;
}

Compilation message

norela.cpp: In function 'int main()':
norela.cpp:59:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
norela.cpp:62:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&l[i]);
   ~~~~~^~~~~~~~~~~~
norela.cpp:63:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int j=1;j<=l[i];j++)scanf("%d",&a[i][j]);
                           ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 238 ms 372 KB Output is correct
2 Correct 319 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 227 ms 368 KB Output is correct
5 Correct 238 ms 376 KB Output is correct
6 Correct 234 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 238 ms 372 KB Output is correct
2 Correct 319 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 227 ms 368 KB Output is correct
5 Correct 238 ms 376 KB Output is correct
6 Correct 234 ms 376 KB Output is correct
7 Execution timed out 1083 ms 256 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 238 ms 372 KB Output is correct
2 Correct 319 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 227 ms 368 KB Output is correct
5 Correct 238 ms 376 KB Output is correct
6 Correct 234 ms 376 KB Output is correct
7 Execution timed out 1083 ms 256 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 238 ms 372 KB Output is correct
2 Correct 319 ms 376 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 227 ms 368 KB Output is correct
5 Correct 238 ms 376 KB Output is correct
6 Correct 234 ms 376 KB Output is correct
7 Execution timed out 1083 ms 256 KB Time limit exceeded
8 Halted 0 ms 0 KB -