#include<bits/stdc++.h>
using namespace std;
namespace std {
// #include<Love>
using ll=long long;
using str=string;
using int128=__int128_t;
using ld=long double;
typedef unsigned int ui;
typedef unsigned long long ull;
#define Love<3 HerLoveForMeJustaDream
}
#define Lovesper_ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pb push_back
#define all(c) c.begin(),c.end()
#define fi first
#define se second
#define debug cout<<"I Love You\n";
#define fu(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define fa(i,s) for(auto&i:s)
#define Bitc(x,i) (((x)>>(i))&1)
#define _log(_x) 63-__builtin_clzll(_x)
#define LoveTime chrono::steady_clock::now().time_since_epoch().count()
const pll dxy4[]={{-1,0},{0,-1},{0,1},{1,0}};
const pll dxy8[]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
constexpr ll Mod=1e9+7;
constexpr ll mxn=1e6+7,mxm=3e3+7;
constexpr long long inf=(1ll<<31);
constexpr ll lnf=(1ll<<60);
struct __TS {
~__TS() {
// cerr<<"Time elapsed: "<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
}__ts;
mt19937 rng(LoveTime);
#define setup ((1<<3)-1>>1)
void OpenLove(const str&name){
// I'm So Lonely. I am Trying To Get Out This Lonely With Her Love
Lovesper_
if(fopen((name+".inp").c_str(),"r")){
// freopen((name+".test").c_str(),"r",stdin);
freopen((name+".inp").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
}
template<class X,class Y>bool maximize(X&x,const Y&y){X eps=1e-18;if(x+eps<y){x=y;return 1;}return 0;}
template<class X,class Y>bool minimize(X&x,const Y&y){X eps=1e-18;if(x>y+eps){x=y;return 1;}return 0;}
ostream&operator<<( std::ostream& dest, __int128_t value){
ostream::sentry s(dest);__uint128_t tmp=value<0?-value:value;
char buffer[128];char*d=end(buffer);
do{d--;*d="0123456789"[tmp%10];tmp/=10;}while(tmp);
if(value<0)d--,*d='-';ll len=end(buffer)-d;
if(dest.rdbuf()->sputn(d,len)!=len)dest.setstate(ios_base::badbit);
return dest;
}
struct custom_hash{
size_t operator()(uint64_t x)const{
static const uint64_t HashRand=LoveTime;
x^=HashRand;return x^(x>>16);
}};
int64_t add(ll&a,ll b){a+=b;if(a>=Mod)a%=Mod;while(a<0)a+=Mod;return a;}
int64_t mul(ll&a,ll b,ll mod){a=1ll*a*b%mod;return a;}
int64_t mpow(ll a,ll b,ll mod){ll ans=1;for(;b;b>>=1,a=mul(a,a,mod))if(b&1)ans=mul(ans,a,mod);return ans;}
ll n,m,g[mxn];
vll graph[mxn];
void Lovesper(const ll&TestCase){
cin>>n;
ll LoveSub3_1=1,LoveSub3_2=1;
fu(i,1,n){
ll x;cin>>x;g[i]=x;
LoveSub3_1&=(g[i]>g[i-1]);
}
fd(i,n-1,1)LoveSub3_2&=(g[i]>g[i+1]);
struct Love1{
function<void()>DreamyLove=[&](){
if(g[1]<=g[2])return void(cout<<1);
cout<<2;
};
};
struct Love2{
function<void()>DreamyLove=[&](){
vll c;
fu(i,1,n)c.pb(g[i]);
sort(all(c));
ll j=0;
do{
auto chk=[&](){
fu(i,1,n)if(c[i-1]!=g[i])return 0;
return 1;
};
j++;
if(chk())return void(cout<<j);
}while(next_permutation(all(c)));
};
};
struct Love3{
function<void(ll)>DreamyLove=[&](ll a){
if(a)return void(cout<<1);
ll j=1;
fu(i,1,n)mul(j,i,Mod);
cout<<j;
};
};
struct Love4{
function<void()>DreamyLove=[&](){
};
};
if(n==2)(new Love1())->DreamyLove();
else if(n<=8)(new Love2())->DreamyLove();
else if(LoveSub3_1||LoveSub3_2)(new Love3())->DreamyLove(LoveSub3_1);
else ;
}
signed main(int argc, char const *argv[]){
OpenLove("lovesper");
int tt=1;
// cin>>tt;
for(ll i=1;i<=tt;i++){
Lovesper(i);
if(i<tt)cout<<'\n';
}
return false;
}
Compilation message
Crypto.cpp:14:13: warning: ISO C++11 requires whitespace after the macro name
14 | #define Love<3 HerLoveForMeJustaDream
| ^~~~
Crypto.cpp: In function 'std::ostream& operator<<(std::ostream&, __int128)':
Crypto.cpp:67:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
67 | if(value<0)d--,*d='-';ll len=end(buffer)-d;
| ^~
Crypto.cpp:67:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
67 | if(value<0)d--,*d='-';ll len=end(buffer)-d;
| ^~
Crypto.cpp: In function 'void OpenLove(const str&)':
Crypto.cpp:56:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
56 | freopen((name+".inp").c_str(),"r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Crypto.cpp:57:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
57 | freopen((name+".out").c_str(),"w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23900 KB |
Output is correct |
3 |
Correct |
10 ms |
23720 KB |
Output is correct |
4 |
Correct |
9 ms |
23900 KB |
Output is correct |
5 |
Correct |
11 ms |
23900 KB |
Output is correct |
6 |
Correct |
10 ms |
23764 KB |
Output is correct |
7 |
Correct |
10 ms |
23956 KB |
Output is correct |
8 |
Correct |
10 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
12 ms |
23952 KB |
Output is correct |
11 |
Correct |
12 ms |
23952 KB |
Output is correct |
12 |
Correct |
10 ms |
23900 KB |
Output is correct |
13 |
Correct |
10 ms |
23904 KB |
Output is correct |
14 |
Correct |
13 ms |
23900 KB |
Output is correct |
15 |
Correct |
10 ms |
23856 KB |
Output is correct |
16 |
Correct |
10 ms |
23900 KB |
Output is correct |
17 |
Correct |
10 ms |
23868 KB |
Output is correct |
18 |
Correct |
10 ms |
23900 KB |
Output is correct |
19 |
Correct |
10 ms |
23796 KB |
Output is correct |
20 |
Correct |
10 ms |
23900 KB |
Output is correct |
21 |
Correct |
10 ms |
23900 KB |
Output is correct |
22 |
Correct |
11 ms |
23900 KB |
Output is correct |
23 |
Correct |
10 ms |
23956 KB |
Output is correct |
24 |
Correct |
11 ms |
23896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
23952 KB |
Output is correct |
2 |
Correct |
31 ms |
29072 KB |
Output is correct |
3 |
Correct |
34 ms |
29016 KB |
Output is correct |
4 |
Correct |
33 ms |
29012 KB |
Output is correct |
5 |
Correct |
32 ms |
29012 KB |
Output is correct |
6 |
Correct |
46 ms |
29008 KB |
Output is correct |
7 |
Correct |
43 ms |
29008 KB |
Output is correct |
8 |
Correct |
31 ms |
29064 KB |
Output is correct |
9 |
Correct |
32 ms |
29012 KB |
Output is correct |
10 |
Correct |
34 ms |
29008 KB |
Output is correct |
11 |
Correct |
33 ms |
29148 KB |
Output is correct |
12 |
Correct |
33 ms |
29144 KB |
Output is correct |
13 |
Correct |
35 ms |
29000 KB |
Output is correct |
14 |
Correct |
33 ms |
28940 KB |
Output is correct |
15 |
Correct |
32 ms |
29128 KB |
Output is correct |
16 |
Correct |
31 ms |
29016 KB |
Output is correct |
17 |
Correct |
36 ms |
29000 KB |
Output is correct |
18 |
Correct |
32 ms |
29008 KB |
Output is correct |
19 |
Correct |
33 ms |
29012 KB |
Output is correct |
20 |
Correct |
33 ms |
29004 KB |
Output is correct |
21 |
Correct |
32 ms |
29008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23900 KB |
Output is correct |
2 |
Incorrect |
28 ms |
28224 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
23900 KB |
Output is correct |
2 |
Incorrect |
13 ms |
24064 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23900 KB |
Output is correct |
3 |
Correct |
10 ms |
23720 KB |
Output is correct |
4 |
Correct |
9 ms |
23900 KB |
Output is correct |
5 |
Correct |
11 ms |
23900 KB |
Output is correct |
6 |
Correct |
10 ms |
23764 KB |
Output is correct |
7 |
Correct |
10 ms |
23956 KB |
Output is correct |
8 |
Correct |
10 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
12 ms |
23952 KB |
Output is correct |
11 |
Correct |
12 ms |
23952 KB |
Output is correct |
12 |
Correct |
10 ms |
23900 KB |
Output is correct |
13 |
Correct |
10 ms |
23904 KB |
Output is correct |
14 |
Correct |
13 ms |
23900 KB |
Output is correct |
15 |
Correct |
10 ms |
23856 KB |
Output is correct |
16 |
Correct |
10 ms |
23900 KB |
Output is correct |
17 |
Correct |
10 ms |
23868 KB |
Output is correct |
18 |
Correct |
10 ms |
23900 KB |
Output is correct |
19 |
Correct |
10 ms |
23796 KB |
Output is correct |
20 |
Correct |
10 ms |
23900 KB |
Output is correct |
21 |
Correct |
10 ms |
23900 KB |
Output is correct |
22 |
Correct |
11 ms |
23900 KB |
Output is correct |
23 |
Correct |
10 ms |
23956 KB |
Output is correct |
24 |
Correct |
11 ms |
23896 KB |
Output is correct |
25 |
Correct |
15 ms |
23900 KB |
Output is correct |
26 |
Incorrect |
13 ms |
24064 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23900 KB |
Output is correct |
2 |
Incorrect |
28 ms |
28224 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
23896 KB |
Output is correct |
2 |
Correct |
10 ms |
23900 KB |
Output is correct |
3 |
Correct |
10 ms |
23720 KB |
Output is correct |
4 |
Correct |
9 ms |
23900 KB |
Output is correct |
5 |
Correct |
11 ms |
23900 KB |
Output is correct |
6 |
Correct |
10 ms |
23764 KB |
Output is correct |
7 |
Correct |
10 ms |
23956 KB |
Output is correct |
8 |
Correct |
10 ms |
23896 KB |
Output is correct |
9 |
Correct |
10 ms |
23896 KB |
Output is correct |
10 |
Correct |
12 ms |
23952 KB |
Output is correct |
11 |
Correct |
12 ms |
23952 KB |
Output is correct |
12 |
Correct |
10 ms |
23900 KB |
Output is correct |
13 |
Correct |
10 ms |
23904 KB |
Output is correct |
14 |
Correct |
13 ms |
23900 KB |
Output is correct |
15 |
Correct |
10 ms |
23856 KB |
Output is correct |
16 |
Correct |
10 ms |
23900 KB |
Output is correct |
17 |
Correct |
10 ms |
23868 KB |
Output is correct |
18 |
Correct |
10 ms |
23900 KB |
Output is correct |
19 |
Correct |
10 ms |
23796 KB |
Output is correct |
20 |
Correct |
10 ms |
23900 KB |
Output is correct |
21 |
Correct |
10 ms |
23900 KB |
Output is correct |
22 |
Correct |
11 ms |
23900 KB |
Output is correct |
23 |
Correct |
10 ms |
23956 KB |
Output is correct |
24 |
Correct |
11 ms |
23896 KB |
Output is correct |
25 |
Correct |
9 ms |
23952 KB |
Output is correct |
26 |
Correct |
31 ms |
29072 KB |
Output is correct |
27 |
Correct |
34 ms |
29016 KB |
Output is correct |
28 |
Correct |
33 ms |
29012 KB |
Output is correct |
29 |
Correct |
32 ms |
29012 KB |
Output is correct |
30 |
Correct |
46 ms |
29008 KB |
Output is correct |
31 |
Correct |
43 ms |
29008 KB |
Output is correct |
32 |
Correct |
31 ms |
29064 KB |
Output is correct |
33 |
Correct |
32 ms |
29012 KB |
Output is correct |
34 |
Correct |
34 ms |
29008 KB |
Output is correct |
35 |
Correct |
33 ms |
29148 KB |
Output is correct |
36 |
Correct |
33 ms |
29144 KB |
Output is correct |
37 |
Correct |
35 ms |
29000 KB |
Output is correct |
38 |
Correct |
33 ms |
28940 KB |
Output is correct |
39 |
Correct |
32 ms |
29128 KB |
Output is correct |
40 |
Correct |
31 ms |
29016 KB |
Output is correct |
41 |
Correct |
36 ms |
29000 KB |
Output is correct |
42 |
Correct |
32 ms |
29008 KB |
Output is correct |
43 |
Correct |
33 ms |
29012 KB |
Output is correct |
44 |
Correct |
33 ms |
29004 KB |
Output is correct |
45 |
Correct |
32 ms |
29008 KB |
Output is correct |
46 |
Correct |
10 ms |
23900 KB |
Output is correct |
47 |
Incorrect |
28 ms |
28224 KB |
Output isn't correct |
48 |
Halted |
0 ms |
0 KB |
- |