Submission #53847551


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {

ll n,m;
cin>>n>>m;
vector<ll>v(n,0),w(m,0);
vector<ll>ans;
for(ll i=0;i<n;i++)
{
    cin>>v[i];
    ans.push_back(v[i]);
}
for(ll i=0;i<m;i++)
{
    cin>>w[i];
     ans.push_back(w[i]);
}
ll cnt=0;
for(ll i=1;i<n;i++)
{
    if(abs(v[i]-v[i-1])==1)
    {
        cnt++;
    }
}
// sort(ans.begin(),ans.end());
// ll k=n+m;
// ll cnt=0;
// for(ll i=0;i<k;i++)
// {
//     for(ll j=0;j<n;j++)
//     {
//         if((v[j]==ans[i]&&v[j+1]==ans[i+1]))
//         {cnt++;}
        
//         else if((v[j]==ans[i+1]&&v[j+1]==ans[i]))
//         {
//             cnt++;
//         }
//     }
// }
if(cnt>0)
{
    cout<<"Yes"<<"\n";
}
else{
    cout<<"No"<<"\n";
}
   return 0;
}

Submission Info

Submission Time
Task B - Piano 2
User Charan06
Language C++ 20 (gcc 12.2)
Score 0
Code Size 804 Byte
Status WA
Exec Time 1 ms
Memory 3672 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 14
WA × 6
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3440 KiB
00_sample_02.txt AC 1 ms 3672 KiB
00_sample_03.txt AC 1 ms 3540 KiB
01_random_01.txt WA 1 ms 3492 KiB
01_random_02.txt AC 1 ms 3492 KiB
01_random_03.txt WA 1 ms 3484 KiB
01_random_04.txt AC 1 ms 3416 KiB
01_random_05.txt WA 1 ms 3532 KiB
01_random_06.txt AC 1 ms 3444 KiB
01_random_07.txt WA 1 ms 3480 KiB
01_random_08.txt AC 1 ms 3612 KiB
01_random_09.txt WA 1 ms 3548 KiB
01_random_10.txt AC 1 ms 3496 KiB
02_handmade_01.txt AC 1 ms 3492 KiB
02_handmade_02.txt AC 1 ms 3492 KiB
02_handmade_03.txt AC 1 ms 3420 KiB
02_handmade_04.txt AC 1 ms 3492 KiB
02_handmade_05.txt AC 1 ms 3480 KiB
02_handmade_06.txt AC 1 ms 3472 KiB
02_handmade_07.txt WA 1 ms 3544 KiB