#include <bits/stdc++.h>
#define N 1000005
#define ll long long int
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("myfile.in","r",stdin);freopen ("myfile.out","w",stdout);
#define mod 1000000007
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;
ll n,m,ar[N],sum,k,mark[N];
int tut[N];
char s[N];
bool check()
{
for(int i=0;i<26;i++)
{
char a='a'+i;
if(s[1]==a)
return 0;
}
return 1;
}
ll f()
{
ll top=0;
for(int i=1;i<=strlen(s+1);i++)
{
top=top*10;
top+=s[i]-'0';
}
return top;
}
int main()
{
fast;
cin>>n;
// for(int i=0;i<26;i++)
// {
// char a='a'+i;
// cout<<a<<sp;
// if(s[i]==a)
// return 0;
// }
// cout<<endl;
int flag=0;
for(int i=1;i<=n;i++)
{
cin>>s+1;
// cout<<check()<<sp;
if(check())
mark[i]=f();
}
// cout<<endl;
fo(i,1,n)
{
cin>>s+1;
// cout<<check()<<sp;
if(check() && mark[i] && mark[i]!=f())
flag=1;
}
if(flag)
cout<<"NE";
else
cout<<"DA";
// int x='a';
// cout<<x;
}
Compilation message
zamjena.cpp: In function 'long long int f()':
zamjena.cpp:41:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=1;i<=strlen(s+1);i++)
~^~~~~~~~~~~~~
zamjena.cpp: In function 'int main()':
zamjena.cpp:64:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
cin>>s+1;
~^~
zamjena.cpp:72:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
cin>>s+1;
~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
396 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Incorrect |
3 ms |
512 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |