# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
93535 | Sa1loum | Norela (info1cup18_norela) | C++14 | 2 ms | 256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mem(a,b) memset(a, b, sizeof(a))
#define F first
#define S second
#define Si size
#define pb(x) push_back(x)
typedef double D;
typedef long long ll;
typedef long double ld;
const int MOD=(int)1e9+7,MAX=(int)1e5+10;
int n,m,x,a[100],q[100][100],num[100],ans;
string s;
string to_strings__(int n){
string t;
t.clear();
int x=10;
while (n!=0) {
t+=(char)(n%x+'0');
n/=x;
}
reverse(t.begin(),t.end());
t+=" ";
return t;
}
bool possible(int a[100],int i) {
/*
for (int k=0;k<num[i];k++) {
a[q[i][k]]++;
}*/
int p=1;
for (int l=1;l<=n;l++) {
if (a[l]%2==0) p=0;
}
if (p) return 1;
for (int j=i;j<m;j++) {
s+=to_strings__(j+1);
ans++;
for (int k=0;k<num[j];k++) {
a[q[j][k]]++;
}
if (possible(a,j+1)) {
return 1;
}
else {
s.pop_back();
while (s[s.size()-1]!=' ') s.pop_back();
ans--;
for (int k=0;k<num[j];k++) {
a[q[j][k]]--;
}
}
}
return 0;
}
int main()
{
s.clear();
s+=" ";
scanf("%d%d",&n,&m);
for (int i=0;i<m;i++) {
cin>>num[i];
for (int j=0;j<num[i];j++) {
cin>>q[i][j];
}
}
for (int i=0;i<m;i++) {
if (possible(a,i)) {
cout<<ans<<endl;
for (int j=1;j<s.size();j++) cout<<s[j];
return 0;
}
s.clear();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |