Submission #417652

# Submission time Handle Problem Language Result Execution time Memory
417652 2021-06-04T05:59:18 Z 장태환(#7548) Parking Problem (innopolis2021_final_A) C++17
0 / 100
19 ms 828 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int T;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> T;
    while(T--)
    {
        string a,b;
        cin >> a >> b ;
        int i;
        int c=0;
        priority_queue<int>o,e;
        for(i=0;i<a.size();i++)
        {
            if(a[i]=='X')
            {
                if(c>1)
                {
                    if(c%2)
                        e.push(c);
                    else
                        o.push(c);
                }
                c=0;
            }
            else
                c++;
        }
        if(c>1)
        {
            if(c%2)
                e.push(c);
            else
                o.push(c);
        }
        for(i=0;i<b.size();i++)
        {
            cout <<((e.size()+o.size())?'Y':'N');
            if(b[i]=='M')
            {
                if(e.size())
                {
                    if(e.top()>2)
                        e.push(e.top()-2);
                    e.pop();
                }
                else if(o.size())
                {
                    if(o.top()>2)
                        o.push(o.top()-2);
                    o.pop();
                }
            }
            else
            {
                if(o.size())
                {
                    if(o.top()>3)
                        o.push(o.top()-3);
                    o.pop();
                }
                else if(e.size())
                {
                    if(e.top()>3)
                        e.push(e.top()-3);
                    e.pop();
                }
            }

        }
         cout <<((e.size()+o.size())?'Y':'N');
        cout <<'\n';
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:16:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(i=0;i<a.size();i++)
      |                 ~^~~~~~~~~
Main.cpp:39:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(i=0;i<b.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 692 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 692 KB Output isn't correct
2 Halted 0 ms 0 KB -