Submission #417644

# Submission time Handle Problem Language Result Execution time Memory
417644 2021-06-04T05:20:01 Z 장태환(#7548) Parking Problem (innopolis2021_final_A) C++17
54 / 100
38 ms 1140 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;
        multiset<int>x;
        for(i=0;i<a.size();i++)
        {
            if(a[i]=='X')
            {
                if(c>1)
                    x.insert(c-1);
                c=0;
            }
            else
                c++;
        }
        if(c>1)
            x.insert(c-1);
        for(i=0;i<b.size();i++)
        {
            cout <<((x.size())?'Y':'N');
            if(x.size())
            {
                auto it=x.end();
                it--;
                int to=*it;
                if(b[i]=='M'&&(*it)==3)
                {
                    it=x.begin();
                    to=*it;
                }
                x.erase(it);
                if(b[i]=='C')
                    to-=3;
                else
                    to-=2;
                if(to>0)
                    x.insert(to);
            }

        }
        cout <<((x.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:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(i=0;i<b.size();i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 16 ms 716 KB Output is correct
2 Correct 20 ms 472 KB Output is correct
3 Correct 38 ms 788 KB Output is correct
4 Correct 23 ms 828 KB Output is correct
5 Correct 20 ms 528 KB Output is correct
6 Correct 23 ms 844 KB Output is correct
7 Correct 25 ms 460 KB Output is correct
8 Correct 36 ms 640 KB Output is correct
9 Correct 17 ms 664 KB Output is correct
10 Correct 21 ms 520 KB Output is correct
11 Correct 34 ms 588 KB Output is correct
12 Correct 17 ms 728 KB Output is correct
13 Correct 22 ms 544 KB Output is correct
14 Correct 33 ms 572 KB Output is correct
15 Correct 26 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 760 KB Output is correct
2 Correct 19 ms 460 KB Output is correct
3 Correct 35 ms 628 KB Output is correct
4 Incorrect 19 ms 760 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 34 ms 1140 KB Output is correct
2 Correct 35 ms 704 KB Output is correct
3 Correct 28 ms 564 KB Output is correct
4 Correct 26 ms 460 KB Output is correct
5 Correct 27 ms 460 KB Output is correct
6 Correct 28 ms 564 KB Output is correct
7 Correct 31 ms 616 KB Output is correct
8 Correct 34 ms 580 KB Output is correct
9 Correct 25 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 716 KB Output is correct
2 Correct 20 ms 472 KB Output is correct
3 Correct 38 ms 788 KB Output is correct
4 Correct 23 ms 828 KB Output is correct
5 Correct 20 ms 528 KB Output is correct
6 Correct 23 ms 844 KB Output is correct
7 Correct 25 ms 460 KB Output is correct
8 Correct 36 ms 640 KB Output is correct
9 Correct 17 ms 664 KB Output is correct
10 Correct 21 ms 520 KB Output is correct
11 Correct 34 ms 588 KB Output is correct
12 Correct 17 ms 728 KB Output is correct
13 Correct 22 ms 544 KB Output is correct
14 Correct 33 ms 572 KB Output is correct
15 Correct 26 ms 516 KB Output is correct
16 Correct 18 ms 760 KB Output is correct
17 Correct 19 ms 460 KB Output is correct
18 Correct 35 ms 628 KB Output is correct
19 Incorrect 19 ms 760 KB Output isn't correct
20 Halted 0 ms 0 KB -