Submission #36230868


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(int a=b;a<c;++a)
#define UU(a,b,c) for(int a=b;a<=c;++a)
#define DN(a,b,c) for(int a=b;a>c;--a)
#define DU(a,b,c) for(int a=b;a>=c;--a)
#define lc(i) (i+1)
#define rc(i) (i+(m-l+1)*2)
#define debug(x) cout << #x << " = " << x << endl;
template<class A, class B>
ostream& operator<<(ostream& os, const pair<A, B> &p) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(int a=b;a<c;++a)
#define UU(a,b,c) for(int a=b;a<=c;++a)
#define DN(a,b,c) for(int a=b;a>c;--a)
#define DU(a,b,c) for(int a=b;a>=c;--a)
#define lc(i) (i+1)
#define rc(i) (i+(m-l+1)*2)
#define debug(x) cout << #x << " = " << x << endl;

template<class A, class B>
ostream& operator<<(ostream& os, const pair<A, B> &p) {
    os <<  '(' << p.first << ',' << p.second << ')';
    return os;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T> &v) {
    bool fs = 1; os << '{';
    for(auto &i : v) { if(!fs) os << ", "; os << i; fs = 0; }
    os << '}'; return os;
}

ll expo(ll a, ll b, const int MOD) {
    ll ans = 1;
    for(; b ; b>>=1, a=a*a%MOD) if(b&1) ans=ans*a%MOD;
    return ans;
}

ll inv(ll x, const int MOD) {
    return expo(x, MOD-2, MOD);
}

const int N = 1e5;

int n, m, t[105], s[105], p[105];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);

    cin >> n;
    for(int i = 0 ; i < n ; ++i) {
        cin >> t[i];
        p[i] = s[i] = i+1;
    }

    prev_permutation(t, t + n);
    for(int i = 0 ; i < n ; ++i) cout << t[i] << (" \n"[i == n-1]);

	return 0;
}

Submission Info

Submission Time
Task C - Previous Permutation
User kresna
Language C++ (GCC 9.2.1)
Score 300
Code Size 1444 Byte
Status AC
Exec Time 6 ms
Memory 3504 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt
Case Name Status Exec Time Memory
example_00.txt AC 6 ms 3472 KB
example_01.txt AC 2 ms 3412 KB
test_00.txt AC 2 ms 3372 KB
test_01.txt AC 2 ms 3404 KB
test_02.txt AC 2 ms 3368 KB
test_03.txt AC 2 ms 3412 KB
test_04.txt AC 2 ms 3476 KB
test_05.txt AC 2 ms 3440 KB
test_06.txt AC 2 ms 3412 KB
test_07.txt AC 2 ms 3444 KB
test_08.txt AC 2 ms 3504 KB
test_09.txt AC 2 ms 3468 KB


2025-02-28 (Fri)
05:16:16 +00:00