# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
126577 |
2019-07-08T06:27:03 Z |
_Samir |
Ronald (COCI17_ronald) |
C++17 |
|
189 ms |
15540 KB |
//github.com/nya-nya-meow/CompetitiveProgramming/blob/master/CSES/CSES%201112%20-%20Substrings.cpp
#include<bits/stdc++.h>
#define pi 3.141592654
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef pair<double,double>pdd;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef complex<double> point;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
const double EPS= 1e-8;
const int N = 1e5+5, M = 2e5+5, OO = 0x3f3f3f3f;
int n,m,vis[2005],id,ck[5000000];
vector<int>a[2005];
void dfs(int u)
{
vis[u]=id;
for(auto v:a[u])
if(vis[v]==-1)dfs(v);
}
int main()
{
input;
cin>>n>>m;
int u,v;
forr(i,1,m)
{
cin>>u>>v;
a[u].push_back(v);
a[v].push_back(u);
}
memset(vis,-1,sizeof vis);
forr(i,1,n)
{
if(vis[i]==-1)
{
id++;
dfs(i);
}
}
set<pair<int,int>>c1,c2;
int cnt1=0,cnt2=0;
forr(i,1,n)
{
if(vis[i]==1)
for(auto v:a[i])
cnt1++,c1.insert({min(i,v),max(i,v)});
else if(vis[i]==2)
for(auto v:a[i])
cnt2++,c2.insert({min(i,v),max(i,v)});
}
for(int i=1;i<=2000;i++)ck[i]=i*(i-1)/2;
if((id==1&&ck[cnt1]==(int)c1.size())||(id==2&&ck[cnt1]==(int)c1.size()&&ck[cnt2]==(int)c2.size()))cout<<"DA"<<endl;
else cout<<"NE"<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
428 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Incorrect |
3 ms |
504 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
760 KB |
Output is correct |
2 |
Correct |
31 ms |
2808 KB |
Output is correct |
3 |
Correct |
158 ms |
10304 KB |
Output is correct |
4 |
Incorrect |
189 ms |
15540 KB |
Output isn't correct |