Submission #420667

#TimeUsernameProblemLanguageResultExecution timeMemory
420667maximath_1MalnaRISC (COI21_malnarisc)C++17
100 / 100
1 ms332 KiB
#include <iostream> #include <unordered_map> #include <algorithm> #include <set> #include <string> #include <vector> #include <random> #include <deque> using namespace std; mt19937 rng(420691273); #define ll long long const int MX = 1e5 + 5; // query = ceil(log) * (ceil(log) + 1) / 2 int main(){ cin.tie(0) -> sync_with_stdio(0); int n; cin >> n; vector<vector<pair<int, int> > > ans; int lg; for(lg = 0; (1 << lg) < n; lg ++); for(int len = 1; len <= lg; len ++){ vector<pair<int, int> > nw; for(int i = 0; i < n; i += (1 << len)) for(int j = 0; j < (1 << (len - 1)); j ++) if(i + (1 << len) - j - 1 < n) nw.push_back({i + j, i + (1 << len) - j - 1}); if(nw.size()) ans.push_back(nw); for(int len2 = len - 1; len2 > 0; len2 --){ nw.clear(); for(int i = 0; i < n; i += (1 << len2)) for(int j = 0; j < (1 << (len2 - 1)); j ++) if(i + j + (1 << (len2 - 1)) < n) nw.push_back({i + j, i + j + (1 << (len2 - 1))}); ans.push_back(nw); } } cout << ans.size() << endl; for(auto i : ans){ for(auto j : i) cout << "CMPSWP R" << j.first + 1 << " R" << j.second + 1 << " "; cout << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...