답안 #417642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
417642 2021-06-04T05:18:28 Z 장태환(#7548) Parking Problem (innopolis2021_final_A) C++17
31 / 100
44 ms 884 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;
        set<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.begin();
                int to=*it;
                if(b[i]=='C'||(*it)==3)
                {
                    it=x.end();
                    it--;
                    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++)
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 716 KB Output is correct
2 Correct 21 ms 476 KB Output is correct
3 Correct 35 ms 604 KB Output is correct
4 Correct 24 ms 796 KB Output is correct
5 Correct 21 ms 588 KB Output is correct
6 Correct 24 ms 884 KB Output is correct
7 Correct 21 ms 464 KB Output is correct
8 Correct 35 ms 616 KB Output is correct
9 Correct 17 ms 676 KB Output is correct
10 Correct 24 ms 512 KB Output is correct
11 Correct 44 ms 648 KB Output is correct
12 Correct 17 ms 792 KB Output is correct
13 Correct 19 ms 472 KB Output is correct
14 Correct 33 ms 580 KB Output is correct
15 Correct 26 ms 444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 736 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 716 KB Output is correct
2 Correct 21 ms 476 KB Output is correct
3 Correct 35 ms 604 KB Output is correct
4 Correct 24 ms 796 KB Output is correct
5 Correct 21 ms 588 KB Output is correct
6 Correct 24 ms 884 KB Output is correct
7 Correct 21 ms 464 KB Output is correct
8 Correct 35 ms 616 KB Output is correct
9 Correct 17 ms 676 KB Output is correct
10 Correct 24 ms 512 KB Output is correct
11 Correct 44 ms 648 KB Output is correct
12 Correct 17 ms 792 KB Output is correct
13 Correct 19 ms 472 KB Output is correct
14 Correct 33 ms 580 KB Output is correct
15 Correct 26 ms 444 KB Output is correct
16 Incorrect 21 ms 864 KB Output isn't correct
17 Halted 0 ms 0 KB -