제출 #66559

#제출 시각아이디문제언어결과실행 시간메모리
66559ekremIli (COI17_ili)C++98
0 / 100
7 ms4364 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; typedef pair < int , int > ii; int n, m, c, b, a[N], aa[N]; char x, y; ii g[N]; char s[N]; void hazirla(){ 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] == 1 or a[g[i].nd] == 1) and abs(a[i]) > 0) a[i] = 1; if(a[g[i].st] == 0 and a[g[i].nd] == 0 and a[i] <= 0) a[i] = 0; } } bool bak(){ for(int i = n + 1; i <= n + m; i++){ if(a[i] == 0 and (a[g[i].st] == 1 or a[g[i].nd] == 1) ) return 0; if(a[i] == 1 and (a[g[i].st] == 0 and a[g[i].nd] == 0) ) return 0; } return 1; } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d %d %s",&n ,&m, s + 1); memset(a, -1, sizeof a); for(int i = n + 1; i <= n + m; i++){ if(s[i - n] == '1') a[i] = 1; if(s[i - n] == '0') a[i] = 0; } for(int i = 1; i <= m; i++){ scanf(" %c%d %c %d",&x, &c, &y ,&b); if(x == 'c') c += n; if(y == 'c') b += n; g[i + n].st = c; g[i + n].nd = b; // cout << i + n << " -> " << c << " , " << b << endl; } hazirla(); for(int i = 1; i <= n + m; i++){ // cout << a[i] << " "; aa[i] = a[i]; } // puts(""); for(int i = n + 1; i <= n + m; i++) if(a[i] == -1){ a[i] = 0; hazirla(); bool f = bak(); // cout << i << " = " << f << " ye bakiliyo\n"; for(int i = 1; i <= n + m; i++)a[i] = aa[i]; if(f == 1) a[i] = -1; else{ a[i] = 1; hazirla(); for(int i = 1; i <= n + m; i++)aa[i] = a[i]; } } for(int i = n + 1; i <= n + m; i++) if(a[i] >= 0) printf("%d",a[i]); else printf("?"); // cout << a[i] << " "; return 0; }

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

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