QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#209958 | #2686. Exam Redistribution | FinalTrack123 | AC ✓ | 0ms | 3748kb | C++20 | 4.0kb | 2023-10-10 20:26:52 | 2023-10-10 20:26:53 |
Judging History
answer
//Shortcuts
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define fi first
#define se second
#define endl "\n"
#define all(x) x.begin(),x.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//Macros
#ifndef ONLINE_JUDGE
#include "debug.h"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//IO functions
void inp(vi& a)
{
for(int i = 0; i < a.size(); i++)
cin >> a[i];
}
void inp(vll& a)
{
for(int i = 0; i < a.size(); i++)
cin >> a[i];
}
ostream& operator << (ostream& s, pi& a)
{
return s << a.fi << " " << a.se;
}
ostream& operator << (ostream& s, pll& a)
{
return s << a.fi << " " << a.se;
}
ostream& operator << (ostream& s, vi& a)
{
for(int i : a)
s << i << " ";
return s;
}
ostream& operator << (ostream& s, vll& a)
{
for(ll i : a)
s << i << " ";
return s;
}
void yes(bool b)
{
if(b)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
//EXTRA FUNCTIONS*******************************************************
const int MOD = 1e9+7;
struct mint
{
int val;
mint(ll v = 0)
{
if(abs(v) < MOD)
val = v;
else
val = v%MOD;
if(val < 0)
val += MOD;
}
};
mint operator+(const mint& a, const mint& b)
{
int res = a.val + b.val;
if(res >= MOD)
return res-MOD;
else
return res;
}
mint operator-(const mint& a, const mint& b)
{
int res = a.val - b.val;
if(res < 0)
return res+MOD;
else
return res;
}
mint operator*(const mint& a, const mint& b)
{
ll res = (ll)a.val * (ll)b.val;
if(res >= MOD)
return res%MOD;
else
return res;
}
mint operator^(const mint& a, ll b)
{
ll res = 1;
ll prod = a.val;
while(b > 0)
{
if(b&1)
res = (res*prod)%MOD;
prod = (prod*prod)%MOD;
b >>= 1;
}
return res;
}
mint operator/(const mint& a, const mint& b)
{
return a*(b^(MOD-2));
}
void operator+=(mint& a, const mint& b)
{
a = a+b;
}
void operator-(mint& a)
{
a = 0-a;
}
void operator-=(mint& a, const mint& b)
{
a = a-b;
}
void operator*=(mint& a, const mint& b)
{
a = a*b;
}
void operator^=(mint& a, ll b)
{
a = a^b;
}
void operator/=(mint& a, const mint& b)
{
a = a/b;
}
bool operator==(const mint& a, const mint& b)
{
return a.val == b.val;
}
ostream& operator << (ostream& s, mint a)
{
return s << a.val;
}
//COMBINATORICS AND FACTORIAL
vector<mint> fact;
vector<mint> ifact;
void cfact(int n)
{
fact.pb(1);
ifact.pb(1);
for(int i = 1; i <= n; i++)
{
fact.pb(fact.back()*i);
ifact.pb(fact.back()^(MOD-2));
}
}
mint comb(int n, int r)
{
return fact[n] * ifact[n-r] * ifact[r];
}
//END OF EXTRA FUNCTIONS************************************************
//Write code here
void run(int test)
{
int n; cin >> n;
int p = 0, ma = 0, sum = 0;
for(int i = 1; i <= n; i++)
{
int e; cin >> e;
sum += e;
if(e > ma)
{
ma = e;
p = i;
}
}
if(sum-ma < ma)
cout << "impossible" << endl;
else
{
cout << p << " ";
for(int i = 1; i <= n; i++)
{
if(i != p)
cout << i << " ";
}
cout << endl;
}
}
//Main function
int main()
{
//Fast IO
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
for(int i = 1; i <= t; i++)
run(i);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
2 23 23
output:
1 2
result:
ok correct solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
3 10 20 31
output:
impossible
result:
ok impossible
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 10 20 30
output:
3 1 2
result:
ok correct solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
28 95 90 9 60 43 54 14 20 45 23 46 3 9 72 43 52 74 36 6 79 59 66 63 98 37 76 37 58
output:
24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25 26 27 28
result:
ok correct solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
21 32 9 48 72 60 45 65 19 18 33 82 20 12 10 4 28 58 83 34 37 29
output:
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21
result:
ok correct solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
11 78 55 26 11 79 71 83 24 55 92 60
output:
10 1 2 3 4 5 6 7 8 9 11
result:
ok correct solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
29 17 98 6 42 3 81 69 98 81 95 54 99 75 35 98 38 20 8 47 20 94 96 22 11 53 17 55 82 26
output:
12 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
result:
ok correct solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
14 91 45 35 90 82 90 69 42 70 83 64 24 30 41
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
result:
ok correct solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
24 56 55 83 11 64 34 56 84 25 96 8 57 55 24 57 48 45 72 1 38 79 15 87 21
output:
10 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24
result:
ok correct solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
22 18 45 43 9 70 49 69 54 56 53 30 90 9 88 87 50 78 68 61 30 32 35
output:
12 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21 22
result:
ok correct solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
11 96 35 39 42 82 48 56 26 28 9 22
output:
1 2 3 4 5 6 7 8 9 10 11
result:
ok correct solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
10 86 51 12 47 13 57 45 86 26 86
output:
1 2 3 4 5 6 7 8 9 10
result:
ok correct solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
9 99 64 5 81 28 37 15 84 10
output:
1 2 3 4 5 6 7 8 9
result:
ok correct solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
23 40 68 30 8 92 66 17 98 92 19 2 62 14 74 47 71 57 78 83 61 60 33 14
output:
8 1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
result:
ok correct solution
Test #15:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
5 86 21 43 32 62
output:
1 2 3 4 5
result:
ok correct solution
Test #16:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
17 86 44 37 66 75 93 32 89 99 99 13 39 78 84 4 40 73
output:
9 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 17
result:
ok correct solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
24 54 22 41 6 32 43 83 59 42 25 32 68 45 18 83 58 97 54 63 43 61 92 99 67
output:
23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24
result:
ok correct solution
Test #18:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
15 7 85 40 39 6 4 40 98 75 71 67 28 17 61 7
output:
8 1 2 3 4 5 6 7 9 10 11 12 13 14 15
result:
ok correct solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
19 52 55 13 7 48 15 65 31 63 76 61 54 20 35 98 27 29 50 55
output:
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19
result:
ok correct solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
25 30 97 3 80 57 91 16 69 95 67 12 93 97 12 83 8 9 80 72 96 64 52 28 58 100
output:
25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
result:
ok correct solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
21 88 20 74 74 8 83 18 22 7 67 15 98 1 81 76 57 58 80 64 14 80
output:
12 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 21
result:
ok correct solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
12 59 52 91 42 86 9 33 68 62 84 21 81
output:
3 1 2 4 5 6 7 8 9 10 11 12
result:
ok correct solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
25 15 14 59 98 62 43 51 81 53 54 60 94 81 84 27 61 83 72 96 92 13 51 36 21 51
output:
4 1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
result:
ok correct solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
30 99 77 10 25 37 89 46 16 56 25 4 60 100 78 74 16 57 64 76 45 6 93 27 74 47 78 34 10 43 49
output:
13 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
30 80 41 67 38 74 18 89 95 3 86 78 70 11 74 78 63 97 95 64 93 15 30 53 53 96 64 63 63 95 41
output:
17 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
30 4 9 2 5 2 2 5 100 3 4 3 2 4 4 1 6 3 2 5 2 3 1 4 2 6 5 3 3 2 2
output:
impossible
result:
ok impossible
Test #27:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
30 5 9 2 5 2 2 5 100 3 4 3 2 4 4 1 6 3 2 5 2 3 1 4 2 6 5 3 3 2 2
output:
8 1 2 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
30 1 2 1 1 1 1 1 1 20 2 1 1 1 1 1 1 1 100 1 1 1 50 1 1 1 1 1 1 1 1
output:
impossible
result:
ok impossible
Test #29:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
30 1 2 2 1 1 1 1 1 20 2 1 1 1 1 1 1 1 100 1 1 1 50 1 1 1 1 1 1 1 1
output:
18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #30:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
30 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #31:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
30 15 29 40 28 18 30 39 42 24 38 20 41 19 35 32 23 22 33 26 34 14 31 37 25 27 36 43 17 21 16
output:
27 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29 30
result:
ok correct solution
Test #32:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
30 9 9 9 9 9 9 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
output:
7 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #33:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
30 3 3 87 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
output:
3 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution
Test #34:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
30 1 1 1 1 1 100 1 1 1 1 1 1 1 1 1 1 1 72 1 1 1 1 1 1 1 1 1 1 1 1
output:
6 1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct solution