# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93535 | 2019-01-09T12:03:39 Z | Sa1loum | Norela (info1cup18_norela) | C++14 | 2 ms | 256 KB |
#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(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |