This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
Compilation message (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... |