제출 #80848

#제출 시각아이디문제언어결과실행 시간메모리
80848farukkastamonudaNorela (info1cup18_norela)C++14
100 / 100
88 ms804 KiB
#include <bits/stdc++.h> #define fi first #define se second #define lo long long #define inf 1000000000 #define md 1000000007 #define li 2005 #define mp make_pair #define pb push_back using namespace std; int n, m, x, y; lo int ans, gg, ind[80]; lo int bet(lo int a, lo int b){ if(__builtin_popcount(a) < __builtin_popcount(b)) return a; if(__builtin_popcount(a) > __builtin_popcount(b)) return b; for(int i = 0;i < m; i ++){ int x = a&(1 << i); int y = b&(1 << i); if(x < y) return b; if(y < x) return a; } return a; } void dfs(int node, lo int msk, lo int ste){ if(msk == gg){ ans=bet(ans, ste); return ; } if(node == m + 1) return ; dfs(node + 1, msk ^ ind[node], ste ^ (1 << (node - 1))); dfs(node + 1, msk, ste); } int main(){ scanf("%d %d", &n, &m); gg = (1LL << n) - 1; ans = (1LL << m) - 1; for(int i = 1; i <= m; i ++){ scanf("%d", &x); for(int j = 1;j <= x; j ++){ scanf("%d", &y); y--; ind[i] ^= (1LL<<y); } } dfs(1, 0, 0); printf("%d\n", __builtin_popcount(ans)); for(int i = 0; i < m; i ++){ if(ans&(1 << i)) printf("%d ", i + 1); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

norela.cpp: In function 'int main()':
norela.cpp:34: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:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
norela.cpp:40:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &y);
    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...