# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
512650 | 2022-01-16T15:31:24 Z | David_M | MalnaRISC (COI21_malnarisc) | C++14 | 1 ms | 332 KB |
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define pii pair<int, int> #define FF first.first #define FS first.second #define pb push_back using namespace std; ll n, T=1; vector <pii> v[1000]; void add(int x, int y, int t){ x++; y++; if(x>n || y>n)return; v[t].pb({x, y});T=t; } int merge(int l, int r, int t){ int m=l+r>>1, e=r-l>>1; while(e){ for (int i=l; i<r; i++)if((i/e-m/e)&1)add(i, i+e, t); e>>=1; t++; } return t; } int solve(int l, int r, int t=1){ if(l+1==r)return t; //cout<<t<<" "; int tt; tt=solve(l, l+r>>1, t); tt=solve(l+r>>1, r, t); tt=merge(l, r, tt); //solve(l, l+r>>1, tt); //tt=solve(l+r>>1, r, tt); return tt; } void output(){ cout<<T<<'\n'; for (int i=1; i<=T; i++){ for(auto [x,y]:v[i])cout<<"CMPSWP R"<<x<<" R"<<y<<" "; cout<<'\n'; } } main(){ios_base::sync_with_stdio(false), cin.tie(0); cin>>n; int k=1; while(k<n)k<<=1; solve(0, k); output(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | not sorted |