제출 #66570

#제출 시각아이디문제언어결과실행 시간메모리
66570ekremIli (COI17_ili)C++98
0 / 100
5 ms4232 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 1000005 using namespace std; int n, m, a[N], aa[N]; pair < int , int > g[N]; void yap(){ for(int i = n + m; i > n; i--){ if(a[i] == 0 and a[g[i].st] <= 0 and a[g[i].nd] <= 0){ a[g[i].st] = 0; a[g[i].nd] = 0; } if(a[g[i].st] == 0 and a[g[i].nd] == 0 and a[i] != 1) a[i] = 0; if((a[g[i].st] == 1 or a[g[i].nd] == 1) and a[i] != 0) a[i] = 1; if(a[i] == 1 and a[g[i].st] == 0 and a[g[i].nd] != 0) a[g[i].nd] = 1; if(a[i] == 1 and a[g[i].nd] == 0 and a[g[i].st] != 0) a[g[i].st] = 1; // cout << a[i] << " -> " << a[g[i].st] << " , " << a[g[i].nd] << endl; } } bool bak(){ for(int i = n + m; i > n; i--){ if(a[i] == 0){ if(a[g[i].st] == 1 or a[g[i].nd] == 1)return 0; a[g[i].st] = 0; a[g[i].nd] = 0; } } for(int i = n + m; i > n; i--){ if(a[g[i].st] == 0 and a[g[i].nd] == 0){ if(a[i] == 1)return 0; a[i] = 0; } } return 1; } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d %d",&n ,&m); memset(a, -1, sizeof a); for(int i = 1; i <= m; i++){ char x; scanf(" %c",&x); if(x == '1') a[i + n] = 1; if(x == '0') a[i + n] = 0; } for(int i = 1; i <= m; i++){ int x, y; char aa, b; scanf(" %c%d %c%d",&aa ,&x ,&b ,&y); if(aa == 'c') x += n; if(b == 'c') y += n; g[i + n].st = x; g[i + n].nd = y; // cout << i + n << " -> " << x << " , " << y << endl; // cout << a[i + n] << " -> " << a[x] << " , " << a[y] << endl; } yap(); for(int i = 1; i <= n + m; i++) aa[i] = a[i]; // for(int i = n + 1; i <= n + m; i++)if(a[i] != -1)printf("%d",a[i]);else printf("?");puts(""); for(int i = n + 1; i <= n + m; i++) if(a[i] == -1){ for(int i = 1; i <= n + m; i++) a[i] = aa[i]; a[i] = 0; // cout << i << " -> " << f << endl; // for(int i = n + 1; i <= n + m; i++)if(a[i] != -1)printf("%d",a[i]);else printf("?");puts(""); if(!bak()) aa[i] = 1; } for(int i = n + 1; i <= n + m; i++) if(aa[i] != -1) printf("%d",aa[i]); else printf("?"); return 0; }

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

ili.cpp: In function 'int main()':
ili.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n ,&m);
  ~~~~~^~~~~~~~~~~~~~~~
ili.cpp:56:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c",&x);
   ~~~~~^~~~~~~~~~
ili.cpp:66:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c%d %c%d",&aa ,&x ,&b ,&y);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...