Submission #1304791


Source Code Expand

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);
  string str1,str2,str3;
  cin >> str1 >> str2 >> str3;
  int l1=0,l2=0,l3=0;
  int k=0;
  int p=0;
  int ans=0;
  while(p==0)
  {
    if(l1==str1.length() && k==0)
    {
      p=1;
      ans=1;
    }
    else if(l2==str2.length() && k==1)
    {
      p=1;
      ans=2;
    }
    else if(l3==str3.length() && k==2)
    {
      p=1;
      ans=3;
    }

    if(k==0)
    {
      if(str1[l1]=='a')
      {
        l1++;
      }
      else if(str1[l1]=='b')
      {
        l1++;
        k=1;
      }
      else if(str1[l1]=='c')
      {
        l1++;
        k=2;
      }
    }
    else if(k==1)
    {
      if(str1[l1]=='a')
      {
        l2++;
        k=0;
      }
      else if(str1[l1]=='b')
      {
        l2++;
      }
      else if(str1[l1]=='c')
      {
        l2++;
        k=2;
      }
    }
    else if(k==2)
    {
      if(str1[l1]=='a')
      {
        l3++;
        k=0;
      }
      else if(str1[l1]=='b')
      {
        l3++;
        k=1;
      }
      else if(str1[l1]=='c')
      {
        l3++;
      }
    }
  }
  if(ans==1)
  {
    cout << "A" << endl;
  }
  else if(ans==2)
  {
    cout << "B" << endl;
  }
  else if(ans==3)
  {
    cout << "C" << endl;
  }
  return 0;
}

Submission Info

Submission Time
Task B - Card Game for Three (ABC Edit)
User horcrux2301
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1498 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status AC
AC × 5
WA × 7
Set Name Test Cases
Sample
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt WA 1 ms 256 KB
02.txt WA 1 ms 256 KB
03.txt WA 1 ms 256 KB
04.txt WA 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt WA 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt WA 1 ms 256 KB
09.txt WA 1 ms 256 KB
10.txt AC 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB