QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#830769#8891. Hipster JazzDe3b0o#15 27ms3916kbC++208.0kb2024-12-24 22:41:022024-12-24 22:41:05

Judging History

This is the latest submission verdict.

  • [2024-12-24 22:41:05]
  • Judged
  • Verdict: 15
  • Time: 27ms
  • Memory: 3916kb
  • [2024-12-24 22:41:02]
  • Submitted

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define mid ((l+r)/2)
#define lc (2*x)
#define rc (2*x+1)

using namespace std;
using namespace __gnu_pbds;

/*

⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡤⣴⠟⠋⢠⣴⣾⣿⡟⠋⠉⡳⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠑⠒⠦⢤⣄⡀⠀⣴⡟⠋⡀⢠⣬⣿⣿⡿⠳⣄⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣴⣫⡾⠋⠀⣶⣿⢿⣿⣥⠄⠠⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⣌⣩⣿⡯⠁⣬⣭⣽⣿⣿⡟⠁⠈⠉⠝⢦⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡼⣽⣟⡀⣠⣼⣿⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠃⠀⢠⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠱⣄
⠀⠀⠀⠀⠀⠀⠸⠃⠻⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣿⣧⣀⣼⠘⣿⠿⣸⠏⠀⣄⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠀⠀⠀⠀⠇⠀⠀⠘⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣏⠀⠀⠈⡄⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠋⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⡝⠳⠀⢰⢱⡀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⡾⠁⠀⠀⠀⠀⠀⠀⠀⢠⣾⣇⠀⢸⠀⠀⠀⠀⠀⠀⠀⢱⢹⣷⠀⠀⠀⠀⠀⠰⡆⠉⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣷⡄⠀⠀⡏⡇⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢠⠞⠀⢀⡔⠀⠀⠀⠀⠀⢀⣿⡿⢹⠀⢸⠀⠀⠀⠀⠀⡀⠀⠘⣿⡿⣷⠀⠀⠀⠀⠀⠹⡀⠀⢳⡀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⡄⠀⢿⣻⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡴⢣⡞⠀⠀⠀⠀⠀⢀⣾⡿⠁⢸⡇⢸⡇⠀⠀⠀⠀⣇⠀⠀⣿⠁⠙⣧⠀⠀⠀⠀⠀⢳⡀⠈⣇⠀⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⣆⢸⣟⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⣼⡿⣁⣘⣀⢧⠈⣿⠀⠀⠀⠀⠸⡄⠀⣸⣀⣀⣹⣷⡀⠀⠀⠀⠀⢧⠀⢸⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⡿⣿⣿⢀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣼⠀⠀⠀⠀⠀⠀⣰⡿⠋⡽⠉⠉⠘⡆⣿⣧⠀⠀⠀⠀⢧⠀⣿⣿⠉⠉⠙⣯⡑⠒⠀⠀⠘⣧⠘⡇⠀⠀⠀⠀⠀⢿⠐⠂⣩⠏⠀⣿⢿⡜⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢸⠃⠀⠀⠀⠀⠀⢰⣿⠃⣴⠁⠀⠀⠀⢻⣼⠹⡆⠀⠀⠀⢸⡇⣿⡟⠀⠀⠀⠈⢿⣄⠀⠀⠀⠙⡆⣷⠀⠀⠀⠀⠀⢸⣄⣠⣏⠀⢠⣿⡎⢧⣂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⣾⠏⢠⣀⣀⣀⡠⠄⠀⢿⣧⠹⡄⠀⠀⠀⣿⣿⣣⠀⠳⣄⠀⠀⠹⣧⡀⠀⠀⢻⢻⠀⠀⠀⠀⠀⠀⣿⣷⣾⣷⡾⣿⡇⠸⣿⠀⠀⠀
⠀⠀⠀⠀⠀⢰⡇⠀⠀⠀⠀⠀⣸⣿⢀⣶⡿⠟⢛⣿⣷⣄⠈⣿⣆⠹⡄⠀⠀⢸⡇⣿⣀⣴⣾⠿⢿⣷⣮⣍⡀⠀⠀⣾⠀⡀⠀⠀⠀⠀⣿⡟⢻⠋⣻⣿⡇⠀⢿⡄⠀⠀
⠀⠀⠀⠀⡀⡜⠀⠀⠀⠀⠀⠀⣿⣿⡿⠋⠀⠐⢻⣿⣿⣿⡀⠈⣿⣦⡙⣄⠀⠸⡇⢸⠛⠛⠀⠀⠠⣾⣿⣿⣿⣦⡀⢸⠀⡇⠀⠀⠀⠀⣿⣶⣾⣿⣿⣿⠃⠀⢸⡇⠀⠀
⠀⠀⠀⠀⡆⠀⠀⠀⠀⠀⠀⢠⣿⡼⠃⠀⠀⣶⣾⣿⣿⣿⡇⠀⠈⢷⡙⢮⣀⠀⣿⠈⠄⠀⠀⢠⣤⣿⣿⣿⣿⣿⣿⣾⢲⡇⠀⠀⠀⠀⡿⣿⣿⣿⣿⡟⠀⠀⢸⣷⠀⠀
⠀⠀⠀⣤⡇⢰⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀⠀⢻⡿⣿⣷⢿⠇⠀⠀⠀⠳⡄⠈⠳⢼⡀⠀⠀⠀⢸⣿⣿⣿⣿⣿⡟⢸⡏⣼⠁⠀⠀⢀⡶⣷⣿⣿⣿⣿⠃⠀⠀⠀⣿⠀⠀
⠀⠀⢰⣻⠀⢸⡇⠀⠀⠀⠀⣼⣿⣿⡄⠀⠀⠘⢧⣀⣰⠞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡇⠀⠤⠀⣹⠁⢠⣣⠇⠀⠀⠀⢸⡇⣿⣿⣿⣿⣿⠀⠀⠀⠀⣿⠀⠀
⠀⠀⡄⠀⠀⢸⣇⠀⢀⠀⠀⣷⣿⡿⢿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠒⠒⠚⠃⠀⣸⡿⠀⠀⠀⠀⢸⡇⣿⣿⣿⣿⣿⠀⠀⠀⠀⣿⠀⠀
⠀⢰⠁⠀⠀⠀⣿⡄⠘⢦⠀⣿⡫⠐⣺⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠀⠀⠀⠀⠀⢸⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠘⠀⠀
⠀⢸⠀⠀⠀⣷⣹⣷⠀⠈⡾⠋⠀⠀⣿⣳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⢹⡇⣼⠀⠀⠀⠀⣼⣿⡟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠈⠁⠀⠀⠀⢷⡻⢧⡞⠁⠉⠉⠭⣅⣈⢧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⣼⣸⠃⠀⠀⠀⢀⣿⡏⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠁⠀⣿⣄⠀⠀⠀⠀⠈⠙⠳⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣷⡇⠀⠀⠀⡀⢸⡿⠀⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡄⠀⠀⠀⠀⠀⠀⠀⠀⡟⢸⡷⣄⠀⠀⠀⠀⠀⠀⠉⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⣾⠙⣿⠁⠀⠀⢠⡇⣾⣷⣼⠥⠤⠤⣤⣄⣀⡀⠀⠀⠀⠀⠀
⡀⠀⠀⠀⠀⠀⠀⠀⢠⡇⣿⡇⣿⣳⣄⠀⠀⠀⠀⠀⠀⠈⠑⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣠⡤⠒⠋⣀⡾⠃⢠⡏⠀⠀⢠⣿⣿⣯⣿⡏⢀⡔⠋⠁⠀⠈⠉⠲⡄⠀⠀⠀
⡇⠀⠀⠀⠀⠀⠀⠀⢸⡇⣿⣷⢸⣿⣿⡷⢤⠀⠀⠀⠀⠀⠀⠈⢻⣓⢦⣀⣀⣤⠶⠚⠉⠀⢀⡠⠞⠁⠀⢀⡾⠀⠀⢀⣾⣯⢿⣿⠋⠰⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡃⠀⠀⠀⠀⠀⠀⠀⢸⡇⢸⣹⣯⣿⠃⢧⠀⡷⡄⠀⠀⠀⠀⠀⠀⢡⡿⠛⢙⣿⣦⣠⠴⠚⠉⠀⠀⢀⣠⡿⠁⠀⣠⣾⣯⡽⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⢸⡇⠈⠻⡆⠀⡾⠁⠀⠀⠀⠀⠀⠀⢀⣾⣧⠴⢺⣿⡉⠀⠀⠀⠀⢀⣤⢾⡟⠁⢀⣴⠟⠉⠁⢸⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠸⡇⡼⠀⠀⠀⢀⡼⠁⠀⠀⠀⠀⠀⠀⠀⣼⠋⠀⠀⠀⡝⢷⠀⢀⡤⠖⠋⣀⣮⠴⠚⠋⠁⠀⠀⢠⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠁⠀⠀⢠⠞⠀⠀⠀⠀⠀⠀⠀⠀⣼⡇⠀⠀⢀⣼⣧⠈⡗⣿⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⠀⡾⠁⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⣠⣶⠃⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⠀⠀⢠⣾⠉⢸⢷⣼⣿⡇⠀⠀⠀⢀⡠⠊⠀⠀⠀⡼⠁⢰⠟⢹⡗⢶⣶⡶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡼⠀⣰⣿⢿⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⡇⠀⣰⠟⢹⠀⠀⠈⡽⠛⢷⡀⠀⠀⠁⠀⠀⠀⠀⣸⠁⢠⣾⠀⣼⠃⢠⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢀⣧⣾⣏⢹⣿⠀⠀⠀⠀⠀⠀⠀⡸⠋⢰⡁⢰⠏⣰⣿⠀⠀⣼⣧⡴⠛⣿⠀⠀⠀⠀⠀⢀⡼⠃⠀⠘⢿⣿⣃⣀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

*/

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll N = 209;

ll n , m;
vector<ll> adj[N];
ll vis[N];
ll e[N];

void dfs(ll x , ll v)
{
    if(vis[x])
    {
        if(vis[x]!=v)
            e[x]=1;
        return;
    }
    vis[x]=v;
    if(v==1)
        v=2;
    else
        v=1;
    for(auto it : adj[x])
        dfs(it,v);
}

int main()
{
    d3
    cin >> n >> m;
    for(int i = 0 ; m>i ; i++)
    {
        ll a , b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    ll w = (1<<n);
    for(int i = 0 ; w>i ; i++)
    {
        ll b = 1;
        ll c[n];
        for(int j = 1 ; n>=j ; j++)
        {
            if(b&i)
                c[j]=1;
            else
                c[j]=2;
            b*=2;
        }
        bool g = 1;
        for(int j = 1 ; n>=j ; j++)
        {
            ll x1 = 0 , x2 = 0;
            for(auto it : adj[j])
            {
                if(c[it]==c[j])
                    x1++;
                else
                    x2++;
            }
            if(x1>x2)
                g=0;
        }
        if(g)
        {
            for(int j = 1 ; n>=j ; j++)
                vis[j]=c[j];
        }
    }
    for(int i = 1 ; n>=i ; i++)
    {
        if(vis[i]==1)
            cout << 'S';
        else
            cout << 'P';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 10
Accepted
time: 1ms
memory: 3576kb

input:

1 0

output:

S

result:

ok correct

Test #2:

score: 10
Accepted
time: 0ms
memory: 3592kb

input:

2 1
2 1

output:

PS

result:

ok correct

Test #3:

score: 10
Accepted
time: 12ms
memory: 3628kb

input:

14 91
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12 9
12 10
12 ...

output:

PPPPPPPSSSSSSS

result:

ok correct

Test #4:

score: 10
Accepted
time: 26ms
memory: 3636kb

input:

15 105
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12 9
12 10
12...

output:

PPPPPPPSSSSSSSS

result:

ok correct

Test #5:

score: 0
Time Limit Exceeded

input:

20 190
2 1
3 1
3 2
4 1
4 2
4 3
5 1
5 2
5 3
5 4
6 1
6 2
6 3
6 4
6 5
7 1
7 2
7 3
7 4
7 5
7 6
8 1
8 2
8 3
8 4
8 5
8 6
8 7
9 1
9 2
9 3
9 4
9 5
9 6
9 7
9 8
10 1
10 2
10 3
10 4
10 5
10 6
10 7
10 8
10 9
11 1
11 2
11 3
11 4
11 5
11 6
11 7
11 8
11 9
11 10
12 1
12 2
12 3
12 4
12 5
12 6
12 7
12 8
12 9
12 10
12...

output:


result:


Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 0ms
memory: 3644kb

input:

7 10
7 4
5 3
6 5
5 2
5 1
2 1
6 2
7 5
7 6
7 3

output:

SPSPPSS

result:

ok correct

Test #9:

score: 15
Accepted
time: 0ms
memory: 3652kb

input:

7 11
4 1
2 1
6 1
6 5
4 2
5 4
7 1
6 3
7 6
4 3
5 3

output:

PSPPSSS

result:

ok correct

Test #10:

score: 15
Accepted
time: 0ms
memory: 3700kb

input:

7 12
5 1
4 1
5 4
5 3
4 2
7 1
3 2
5 2
7 6
7 2
6 2
3 1

output:

PPSSSSS

result:

ok correct

Test #11:

score: 15
Accepted
time: 0ms
memory: 3664kb

input:

7 13
5 2
6 2
2 1
7 5
6 3
4 1
6 4
3 1
7 2
7 3
6 1
4 3
7 4

output:

PPPSSSS

result:

ok correct

Test #12:

score: 15
Accepted
time: 0ms
memory: 3576kb

input:

7 14
3 1
4 2
5 3
7 6
5 2
5 1
6 4
7 5
7 4
6 5
2 1
4 1
5 4
6 1

output:

PSSPPSS

result:

ok correct

Test #13:

score: 15
Accepted
time: 0ms
memory: 3708kb

input:

7 15
3 2
4 3
7 5
7 6
5 2
6 1
4 2
7 2
6 2
7 4
6 3
3 1
5 3
5 1
6 5

output:

SPPSPSS

result:

ok correct

Test #14:

score: 15
Accepted
time: 10ms
memory: 3660kb

input:

15 56
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15

output:

PPPPPPPSSSSSSSS

result:

ok correct

Test #15:

score: 15
Accepted
time: 18ms
memory: 3660kb

input:

15 66
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
14 11
5 3
12 9
2 1
5 2
15 9
...

output:

PPPPPPPSSSSSSSS

result:

ok correct

Test #16:

score: 15
Accepted
time: 23ms
memory: 3664kb

input:

15 86
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
2 8
2 9
2 10
2 11
2 12
2 13
2 14
2 15
3 8
3 9
3 10
3 11
3 12
3 13
3 14
3 15
4 8
4 9
4 10
4 11
4 12
4 13
4 14
4 15
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
6 1
4 1
14 8
15 10
10 8
15 9...

output:

PPPPPPPSSSSSSSS

result:

ok correct

Test #17:

score: 15
Accepted
time: 5ms
memory: 3700kb

input:

15 14
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15

output:

PSSSSSSSSSSSSSS

result:

ok correct

Test #18:

score: 15
Accepted
time: 9ms
memory: 3628kb

input:

15 30
15 4
8 3
11 10
15 1
12 9
2 1
6 3
14 11
14 4
7 1
14 10
13 10
14 13
11 2
11 4
12 8
5 2
7 5
10 5
9 2
15 9
9 6
13 8
14 1
11 7
11 5
14 2
13 7
9 5
6 2

output:

PPSPPPSPSPSSSSS

result:

ok correct

Test #19:

score: 15
Accepted
time: 12ms
memory: 3644kb

input:

15 40
14 6
13 4
5 3
9 4
15 12
15 8
13 10
3 2
8 4
11 2
13 3
12 1
9 1
10 3
8 2
2 1
14 5
15 6
15 11
9 5
8 6
9 7
14 8
12 2
15 5
15 9
12 3
7 4
5 1
11 9
11 4
4 1
6 5
10 5
9 6
11 10
7 6
14 11
4 2
9 8

output:

SPPPPPSSPSSSSSS

result:

ok correct

Test #20:

score: 15
Accepted
time: 15ms
memory: 3660kb

input:

15 50
14 2
15 7
7 5
12 8
8 5
12 4
11 5
15 8
8 6
13 4
7 2
3 2
11 3
14 4
10 3
6 5
15 4
14 5
6 3
7 1
8 2
13 11
13 3
11 4
9 3
14 3
11 2
11 8
13 6
5 4
11 10
12 1
15 5
10 7
14 8
12 3
11 1
15 3
13 5
12 10
15 11
13 1
10 2
13 8
13 12
7 4
12 7
9 4
12 11
5 2

output:

PPPPSPPPSSSSSSS

result:

ok correct

Test #21:

score: 15
Accepted
time: 14ms
memory: 3708kb

input:

15 60
5 4
11 7
12 1
11 9
14 8
4 1
11 8
9 7
10 5
6 3
13 3
11 5
12 11
9 4
4 3
13 7
8 2
5 2
12 7
10 2
14 1
8 1
15 8
9 1
14 13
15 2
9 8
6 1
13 12
10 4
14 6
14 12
9 5
9 2
8 4
13 11
15 4
12 5
7 6
6 5
5 1
10 3
13 4
14 11
15 9
10 1
14 10
13 1
8 5
11 10
15 6
10 8
15 3
15 1
9 3
13 10
14 5
10 6
13 9
8 6

output:

PSSPPPPSPPSSSSS

result:

ok correct

Test #22:

score: 15
Accepted
time: 21ms
memory: 3592kb

input:

15 70
13 5
10 6
13 4
15 6
12 1
10 5
2 1
11 10
14 13
9 8
9 1
14 2
14 5
9 5
14 1
3 1
11 9
13 2
13 6
4 3
7 4
15 8
15 4
9 6
5 3
14 7
11 4
11 3
15 1
6 1
13 1
12 3
12 8
15 13
14 4
15 9
12 7
12 11
13 8
6 5
15 3
3 2
13 7
8 6
14 12
4 1
5 4
10 1
14 9
14 6
12 2
10 7
15 7
8 2
13 3
13 12
15 5
7 3
15 2
8 1
11 8
7...

output:

PPPSPPPSSSPSSSS

result:

ok correct

Test #23:

score: 15
Accepted
time: 24ms
memory: 3588kb

input:

15 80
5 1
12 3
15 8
8 1
13 9
9 3
8 4
12 4
15 3
14 6
11 3
11 10
7 3
15 14
14 13
15 11
7 2
10 3
14 5
9 7
14 9
13 3
15 6
6 3
15 2
11 6
14 1
12 8
14 4
7 4
3 2
13 11
14 7
6 5
11 7
2 1
15 4
6 4
9 4
8 5
10 4
10 5
12 2
4 1
7 1
11 9
13 6
10 7
15 9
14 8
13 5
10 1
8 3
11 8
10 6
14 11
9 6
6 2
13 2
13 10
15 5
11...

output:

PPPPPPPPSSSSSSS

result:

ok correct

Test #24:

score: 15
Accepted
time: 27ms
memory: 3600kb

input:

15 90
12 7
15 6
10 1
12 10
7 2
11 4
14 10
12 2
14 2
12 4
11 1
8 2
6 3
13 9
10 4
10 7
13 3
12 9
9 2
15 13
12 3
4 2
7 4
5 4
13 1
15 3
5 2
10 3
15 11
11 9
11 8
13 2
12 6
14 4
7 6
10 2
15 2
6 2
11 7
13 8
11 2
13 6
7 1
10 8
14 5
9 5
14 3
10 6
9 6
11 6
6 1
13 7
15 7
14 6
6 5
12 8
14 9
5 1
10 9
9 3
11 10
1...

output:

PPPPPPPPSSSSSSS

result:

ok correct

Test #25:

score: 15
Accepted
time: 4ms
memory: 3588kb

input:

14 56
2 14
9 14
2 11
3 7
12 8
1 8
1 6
12 6
12 4
13 11
5 10
13 10
1 7
9 11
3 4
9 6
2 4
13 7
5 8
1 10
3 14
3 6
5 4
12 7
13 14
9 10
2 8
5 11
13 2
12 9
1 9
2 1
13 12
9 3
1 13
1 5
3 12
3 13
5 2
2 9
12 5
3 5
8 14
8 7
10 14
8 11
6 7
6 10
11 6
10 4
8 10
4 14
14 11
7 4
11 7
4 6

output:

PPPPPSPSPSSSSS

result:

ok correct

Test #26:

score: 15
Accepted
time: 8ms
memory: 3588kb

input:

14 56
1 4
5 2
13 10
13 4
7 3
6 4
5 14
8 2
6 12
7 10
1 10
13 14
1 12
11 3
6 3
11 10
1 9
8 9
5 3
7 4
7 9
5 9
6 2
13 12
11 2
8 14
8 12
11 14
5 11
13 8
5 1
7 13
6 13
7 5
1 8
6 11
1 6
11 8
13 5
7 6
7 8
1 11
3 4
9 2
14 3
14 10
4 9
3 9
12 2
10 9
14 2
4 12
3 12
4 14
2 10
10 12

output:

PPPPPSSPSPSSSS

result:

ok correct

Test #27:

score: 15
Accepted
time: 13ms
memory: 3644kb

input:

14 84
2 9
7 4
1 3
13 6
1 12
1 9
5 4
7 3
7 12
2 3
2 6
13 11
5 3
14 12
14 10
8 6
8 9
7 11
13 12
5 10
5 11
5 12
1 11
13 10
14 6
14 3
2 4
8 4
7 9
8 10
13 3
13 9
1 6
8 12
2 11
14 9
7 10
1 4
8 11
14 4
2 10
5 6
2 7
13 1
14 5
1 14
5 8
13 8
5 13
13 14
2 1
2 13
7 1
13 7
8 7
5 2
8 1
2 14
14 8
7 5
7 14
8 2
1 5
...

output:

PPPPPPPSSSSSSS

result:

ok correct

Test #28:

score: 15
Accepted
time: 13ms
memory: 3652kb

input:

14 84
14 8
5 12
4 3
10 1
10 12
5 9
10 8
13 9
13 6
14 1
5 7
14 12
11 3
11 7
11 6
2 1
4 1
5 6
4 12
13 3
14 9
5 1
4 6
10 6
4 8
2 8
4 7
13 7
11 8
2 3
2 9
13 8
11 9
14 6
5 3
14 7
2 12
13 12
10 3
11 1
2 7
10 9
4 13
14 11
4 14
2 11
4 5
11 10
5 10
10 13
4 2
11 13
2 13
14 10
2 5
13 14
13 5
11 4
5 14
10 2
10 ...

output:

PPPPPPPSSSSSSS

result:

ok correct

Subtask #3:

score: 0
Wrong Answer

Test #29:

score: 0
Wrong Answer
time: 2ms
memory: 3884kb

input:

200 10000
1 101
1 102
1 103
1 104
1 105
1 106
1 107
1 108
1 109
1 110
1 111
1 112
1 113
1 114
1 115
1 116
1 117
1 118
1 119
1 120
1 121
1 122
1 123
1 124
1 125
1 126
1 127
1 128
1 129
1 130
1 131
1 132
1 133
1 134
1 135
1 136
1 137
1 138
1 139
1 140
1 141
1 142
1 143
1 144
1 145
1 146
1 147
1 148
1 ...

output:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

result:

wrong answer Student 0 has 100 friends playing same instrument, 0 play other

Subtask #4:

score: 0
Wrong Answer

Test #40:

score: 0
Wrong Answer
time: 6ms
memory: 3916kb

input:

200 10000
1 131
66 3
132 193
97 25
53 198
166 25
77 27
108 162
187 46
18 39
147 158
147 116
16 139
172 169
38 15
16 50
60 133
29 105
88 105
170 179
156 139
49 70
53 10
189 82
165 145
137 75
17 162
32 103
200 35
164 75
184 10
49 52
197 103
41 121
111 151
184 57
189 68
185 23
100 95
31 195
55 163
134 ...

output:

PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

result:

wrong answer Student 0 has 100 friends playing same instrument, 0 play other