제출 #535691

#제출 시각아이디문제언어결과실행 시간메모리
535691colazcyRonald (COCI17_ronald)C++17
120 / 120
44 ms3156 KiB
#include <cstdio>
#include <cassert>
#define let const auto
#define rep(name,beg,end) for(auto lim_##name = end,name = beg;name <= lim_##name;name++)
#define per(name,beg,end) for(auto lim_##name = end,name = beg;name >= lim_##name;name--)
#define repn(lim) for(auto REPN_lIM = lim,REPN = 1;REPN <= REPN_lIM;REPN++)
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define trace() debug("line : %d, Function : %s\n",__LINE__,__FUNCTION__)
constexpr int maxn = 1e3 + 10;

int n,m;
bool now[maxn],g[maxn][maxn];
bool chk(const int beg){
	now[1] = beg;
	rep(i,1,n)now[i] = now[1] ^ g[1][i];
	rep(u,1,n)
		rep(v,1,n)
			if((now[u] ^ now[v]) != g[u][v])return false;
	return true;
}
int main(){
	// std::freopen("ronald.in","r",stdin);
	// std::freopen("ronald.out","w",stdout);
	std::scanf("%d",&n);
	rep(u,1,n)
		rep(v,1,n)
			if(u != v)
				g[u][v] = true;
	std::scanf("%d",&m);
	repn(m){
		int u,v; std::scanf("%d %d",&u,&v);
		g[u][v] ^= 1;
		g[v][u] ^= 1;
	}
	if(chk(0))return std::puts("DA"),0;
	if(chk(1))return std::puts("DA"),0;
	std::puts("NE");		
	std::fclose(stdin);
	std::fclose(stdout);
	return 0;
}

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

ronald.cpp: In function 'int main()':
ronald.cpp:24:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |  std::scanf("%d",&n);
      |  ~~~~~~~~~~^~~~~~~~~
ronald.cpp:29:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |  std::scanf("%d",&m);
      |  ~~~~~~~~~~^~~~~~~~~
ronald.cpp:31:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |   int u,v; std::scanf("%d %d",&u,&v);
      |            ~~~~~~~~~~^~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...