이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |