Submission #685237

# Submission time Handle Problem Language Result Execution time Memory
685237 2023-01-23T17:50:53 Z nihaddhuseynli Money (IZhO17_money) C++14
0 / 100
5 ms 9748 KB
//Bismillahi Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std; 
typedef long long LL;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<string, string> pss;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pll> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;
double EPS = 1e-9;
const int N = (int)1e6 + 77;
const ll inf =1000001;
double PI = acos(-1);
int dirx[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8] = { 0, 1, -1, 0, -1, 1, -1, 1 };
ll m,n,k,g,x,y,u,b[inf],a[inf],ans,fact[1000001],d[inf],r,cur,ans1,flag,flag1,flag2,flag3,flag4,cnt,cnt1,cnt2,cnt3,minn,maxx,maxx1,sum,sum1,ans2,ans3;
vector<ll> adj[200000];
ll c[inf];
ll visited[200001];
ll dis[200001];
ll mat[1001][1001]; 
string str,str1,str2,str3;
const int md = 1e9+7;
vector<pair<ll,ll>>v;
vl v2,res;
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>pq;
map<ll,ll>mp;
map<char,ll>mp1;
queue<ll> q;
set<ll>s;
unordered_set<LL> ms;
stack<LL>st;
double pi=3.14159265358979323846;
bool ok[1000][1000];
ll dp[200001];
vector<ll> v1[200000];
ll check[2001][2001];
bool prime[200001];
#define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a) = (b)-1; (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a) = (b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a) = (b); (a) <= (c); ++(a))
#define FOREACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a,b) a=max(a,b)
#define MIN(a, b) a = min(a, b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define TC(t) while (t--)
#define ins insert
#define PERMUTE next_permutation
ll modmul(ll,ll,ll);
ll powmod(ll,ll,ll);
ll inv(ll,ll);
ll nCkm(ll,ll,ll);
ll nCk(ll,ll);

void func(ll x)
{
    v2.clear();
    cnt=sqrt(x);
    FORN(i,1,cnt)
    {
        if(n%i==0)
        {
            if(i!=1)
            {
                v2.pb(i);
                if(n/i!=i)
                {
                    v2.pb(n/i);
                }
            }
        }
    }

}

/*********/

void solve()
{

    cin >> n;
    FOR(i,0,n)
    {
        cin >> a[i];
    }
    FOR(i,0,n-1)
    {
        if(a[i]>a[i+1])
        {
            cnt++;
        }
    }
    cout << cnt+1 << endl;

}

/*********/
 
int main()
{       
    ios::sync_with_stdio(0);    
    cin.tie(0);
    int t=1;
    int i =1;
    //cin >> t;
    //freopen("closing.in", "r", stdin);
    //freopen("closing.out", "w", stdout); 
    TC(t)
    {
        solve();
    }
    return 0;
}

ll modmul(ll x,ll y,ll md){
    if(y==1){
        return x;
    }
    if(y%2){
        return (x+modmul(x,y-1,md))%md;
    }
    else{
        return (modmul((x+x)%md,y/2,md))%md;
    }
}
ll powmod(ll a,ll b,ll m){
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
ll inv(ll n,ll md){
    return powmod(n,md-2,md);
}
ll nCkm(ll n,ll k,ll md){
    return (fact[n]*inv(fact[k],md)%md)*inv(fact[n-k],md)%md;
}
ll nCk(ll n,ll m){
    cnt=1;
    FORN(i,1,m){
        cnt*=(n-i+1);
        cnt/=i;
    }
    return cnt;
}

Compilation message

money.cpp: In function 'void func(ll)':
money.cpp:44:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   44 | #define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
      |                               ^
money.cpp:78:5: note: in expansion of macro 'FORN'
   78 |     FORN(i,1,cnt)
      |     ^~~~
money.cpp: In function 'void solve()':
money.cpp:43:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   43 | #define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
      |                              ^
money.cpp:101:5: note: in expansion of macro 'FOR'
  101 |     FOR(i,0,n)
      |     ^~~
money.cpp:43:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   43 | #define FOR(a, b, c) for (int(a) = (b); (a) < (c); ++(a))
      |                              ^
money.cpp:105:5: note: in expansion of macro 'FOR'
  105 |     FOR(i,0,n-1)
      |     ^~~
money.cpp: In function 'int main()':
money.cpp:123:9: warning: unused variable 'i' [-Wunused-variable]
  123 |     int i =1;
      |         ^
money.cpp: In function 'll nCk(ll, ll)':
money.cpp:44:31: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   44 | #define FORN(a, b, c) for (int(a) = (b); (a) <= (c); ++(a))
      |                               ^
money.cpp:164:5: note: in expansion of macro 'FORN'
  164 |     FORN(i,1,m){
      |     ^~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Incorrect 5 ms 9748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Incorrect 5 ms 9748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Incorrect 5 ms 9748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 9684 KB Output is correct
2 Incorrect 5 ms 9748 KB Output isn't correct
3 Halted 0 ms 0 KB -