Submission #420697

# Submission time Handle Problem Language Result Execution time Memory
420697 2021-06-08T13:21:12 Z JvThunder MalnaRISC (COI21_malnarisc) C++14
33.3247 / 100
13 ms 2772 KB
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
typedef long long ll;
 
using namespace std;
 
int n;
 
bool cmp(int a,int b,int c,int d)
{
    if(a!=c && a!=d && b!=c && b!=d) return true;
    return false;
}

vector<pair<int,int>> v[100005];
void solve()
{
    cin >> n;
    int cnt = 1;
    for(int i=1;i<=n;i++)
    {
        for(int j=n;j>=i+1;j--)
        {
            bool cantog = false;
            for(int k=1;k<=cnt;k++)
            {
                bool caninv = true;
                for(auto x:v[k])
                {
                    if(cmp(i,j,x.fir,x.sec)==false)
                    {
                        caninv = false;
                        break;
                    }
                }
                if(caninv)
                {
                    cantog = true;
                    v[k].pb({i,j});
                    break;
                }
            }
            if(!cantog)
            {
                cnt++;
                v[cnt].pb({i,j});
            }
        }
    }
 
    cout << cnt << endl;
    for(int i=1;i<=cnt;i++)
    {
        for(auto x:v[i])
        {
            cout << "CMPSWP R" << x.fir << " R" << x.sec << " ";
        }
        cout << endl;
    }
	return;
}
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int tc=1;
	//cin>>tc;
	for(int i=1;i<=tc;i++) solve();
 	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2580 KB not sorted
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 2636 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 3 ms 2636 KB Partially correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2636 KB not sorted
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 2636 KB Partially correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2636 KB not sorted
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 2764 KB not sorted
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 2764 KB not sorted
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2772 KB not sorted