Submission #734828

#TimeUsernameProblemLanguageResultExecution timeMemory
734828rahidilbayramliXor Sort (eJOI20_xorsort)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define vl vector<ll> #define sl set<ll> #define pb push_back #define all(v) v.begin(), v.end() #define f first #define s second #define ld long double using namespace std; int main() { ll n, k, i, l = 0; cin >> n >> k; vl v(n); for(ll&h : v) cin >> h; if(k == 1) { vector<pll>v1; for(i = 0; i < n - 1; i++) { if(v[i] > v[i+1] && v1.size() == 0) v1.pb({i+1, i+2}); else if(v[i] > v[i+1] && v1.size() != 0) v1.pb({i+2, i+1}); } cout << v1.size() << "\n"; for(const pll x : v1) cout << x.f << ' ' << x.s << "\n"; } }

Compilation message (stderr)

xorsort.cpp: In function 'int main()':
xorsort.cpp:15:17: warning: unused variable 'l' [-Wunused-variable]
   15 |     ll n, k, i, l = 0;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...