Submission #844754

#TimeUsernameProblemLanguageResultExecution timeMemory
844754dostsKnjige (COCI20_knjige)C++14
0 / 50
2 ms988 KiB
#include <bits/stdc++.h> #pragma optimize "DostSeferoğlu" #pragma GCC optimize("unroll-loops,Ofast") #pragma GCC target("avx2,tune=native") using namespace std; #define int long long #define pii pair<int,int> #define bg begin #define vi vector<int> #define endl '\n' #define vvi vector<vi> #define vp vector<pii> #define sp << " " << #define all(x) x.bg()+1,x.end() #define ff first #define ss second #define brake {cout << "OK\n";return;} #define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;} #define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx) #define F(xx,yy) for (int xx=1;xx<=yy;++xx) #define pb push_back const int inf = 1e18; const int MOD = 998244353; const int N = 2e5+1; vector<string> ops; void solu_bosalt(vi& a,vi& b,int ptr) { while (!a.empty()) { ops.push_back("AL L L");// sol elle solu al ops.push_back("KOY L R");// sol elle sağa koy b.push_back(a.back()); a.pop_back(); } } void hallet(vi& a,vi& b,int ptr) { solu_bosalt(a,b,ptr); ops.push_back("KOY R L"); } void sag_ele_al(vi& a,vi& b,int ptr) { while (!a.empty()) { if (a.back() == ptr) { ops.pb("AL R L"); a.pop_back(); return; } else { ops.pb("AL R L"); ops.pb("KOY R R"); b.push_back(a.back()); a.pop_back(); } } while (!b.empty()) { if (b.back() == ptr) { b.pop_back(); ops.pb("AL R R"); return; } else { a.pb(b.back()); b.pop_back(); ops.pb("AL R R"); ops.pb("KOY R L"); } } } void solve() { int n; cin >> n; vi thicks; vi a(n); for (int i=0;i<n;i++) cin >> a[i]; for (auto it : a) thicks .pb(it); sort(thicks.bg(),thicks.end(),greater<int>()); vi b{}; int left_hand = 0,right_hand = 0; for (auto it : thicks) { sag_ele_al(a,b,it); debug(a); debug(b); hallet(a,b,it); } cout << ops.size() << endl; for (auto it : ops) { cout << it << endl; } } signed main() { ios_base::sync_with_stdio(0);cin.tie(0); #ifdef Local freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }

Compilation message (stderr)

Main.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    2 | #pragma optimize "DostSeferoğlu"
      | 
Main.cpp: In function 'void solve()':
Main.cpp:81:9: warning: unused variable 'left_hand' [-Wunused-variable]
   81 |     int left_hand = 0,right_hand = 0;
      |         ^~~~~~~~~
Main.cpp:81:23: warning: unused variable 'right_hand' [-Wunused-variable]
   81 |     int left_hand = 0,right_hand = 0;
      |                       ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...