제출 #414704

#제출 시각아이디문제언어결과실행 시간메모리
414704juggernautThe Xana coup (BOI21_xanadu)C++17
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> #define fr first #define sc second using namespace std; void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} typedef long long ll; #define USING_ORDERED_SET 0 #if USING_ORDERED_SET #include<bits/extc++.h> using namespace __gnu_pbds; template<class T>using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>; #endif template<class T>void umax(T &a,T b){if(a<b)a=b;} template<class T>void umin(T &a,T b){if(b<a)a=b;} #ifdef IOI2021SG #define printl(args...)printf(args) #else #define printl(args...)((void)0) #endif int a[100005]; int main(){ int n; scanf("%d"); for(int i=1,x;i<n;i++)scanf("%d%d",&x,&x); for(int i=1;i<=n;i++)scanf("%d",&a[i]); int cnt=0; for(int i=2;i<=n;i++){ if(a[i-1]==0){ cnt++; a[i]^=1; a[i+1]^=1; } } if(a[n]==0)puts("impossible"); else printf("%d",cnt); }

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

xanadu.cpp: In function 'int main()':
xanadu.cpp:23:13: warning: format '%d' expects a matching 'int*' argument [-Wformat=]
   23 |     scanf("%d");
      |            ~^
      |             |
      |             int*
xanadu.cpp: In function 'void usaco(std::string)':
xanadu.cpp:5:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xanadu.cpp:5:66: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | void usaco(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                                                           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xanadu.cpp: In function 'int main()':
xanadu.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     scanf("%d");
      |     ~~~~~^~~~~~
xanadu.cpp:24:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     for(int i=1,x;i<n;i++)scanf("%d%d",&x,&x);
      |                           ~~~~~^~~~~~~~~~~~~~
xanadu.cpp:25:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     for(int i=1;i<=n;i++)scanf("%d",&a[i]);
      |                          ~~~~~^~~~~~~~~~~~
xanadu.cpp:24:20: warning: 'n' is used uninitialized in this function [-Wuninitialized]
   24 |     for(int i=1,x;i<n;i++)scanf("%d%d",&x,&x);
      |                   ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...