답안 #873633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
873633 2023-11-15T12:09:18 Z vjudge1 Ronald (COCI17_ronald) C++17
120 / 120
77 ms 10204 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")

#define tof_io  ios_base::sync_with_stdio(false);cin.tie(0) , cout.tie(0);
#define double  long double
#define int     long long
#define pb      push_back

#define all(x)  x.begin(),x.end()
#define endl    '\n'
#define sz(x) 	x.size()
//const int mod = 998244353; //998244353 1e9+7 1e9+9
const int N = 5e3 + 23;	
const int lg = 23;
const int inf = 2e18;
int fac[N];
int inv[N];
double cnt1 = 0.0;
//int  dnt_pow	(int a, int b, int md = mod){int ans = 1; while(b){if(b&1){ans = (a*ans)%md;}a = (a*a)%md;b >>= 1;}return ans ;}
//void dnt_bld	(){fac[0] = 1; inv[0] = dnt_pow(fac[0],mod-2) ;for(int i = 1 ; i < N ; i++) {fac[i] = (fac[i-1] * i) % mod;inv[i] = dnt_pow( fac[i] , mod-2);}}
//int  dnt_ncr	(int r,int n){if(r>n) return 0; return fac[n] * inv[r] % mod * inv[n-r] % mod;}
int32_t main() 
{
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<vector<int>> vc(n);
    for (int i = 0; i < n; i++) 
	{
        vc[i].assign(n, 1);
        vc[i][i] = 0;
    }
    while (m--) 
	{
        int u, v;
        cin >> u >> v;
        vc[u-1][v-1] = 0;
		vc[v-1][u-1] = 0;
    }
    //
	bool fl1 = 1;
	bool fl2 = 1;

    int val[vc.size()];
    for (int i = 0; i < vc.size(); i++) 
	{
        val[i] = vc[0][i] ^ 0;
    }
    for (int i = 0; i < vc.size(); i++) 
	{
        for (int j = 0; j < vc.size(); j++) 
		{
            if (vc[i][j] != (val[i] ^ val[j])) 
			{
                fl1 = 0;
            }
        }
    }
    val[vc.size()];
    for (int i = 0; i <vc.size(); i++) 
	{
        val[i] = vc[0][i] ^ 1;
    }
    for (int i = 0; i < vc.size(); i++) 
	{
        for (int j = 0; j < vc.size(); j++) 
		{
            if (vc[i][j] != (val[i] ^ val[j])) 
			{
                fl2 = 0;
            }
        }
    }
	//

	if(fl1 or fl2) cout <<"DA";
	else cout <<"NE";
}

Compilation message

ronald.cpp: In function 'int32_t main()':
ronald.cpp:47:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for (int i = 0; i < vc.size(); i++)
      |                     ~~^~~~~~~~~~~
ronald.cpp:51:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |     for (int i = 0; i < vc.size(); i++)
      |                     ~~^~~~~~~~~~~
ronald.cpp:53:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         for (int j = 0; j < vc.size(); j++)
      |                         ~~^~~~~~~~~~~
ronald.cpp:62:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for (int i = 0; i <vc.size(); i++)
      |                     ~~^~~~~~~~~~
ronald.cpp:66:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for (int i = 0; i < vc.size(); i++)
      |                     ~~^~~~~~~~~~~
ronald.cpp:68:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |         for (int j = 0; j < vc.size(); j++)
      |                         ~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 480 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 19 ms 2652 KB Output is correct
3 Correct 7 ms 1316 KB Output is correct
4 Correct 5 ms 1260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 13 ms 2648 KB Output is correct
3 Correct 54 ms 9556 KB Output is correct
4 Correct 77 ms 10204 KB Output is correct