# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1203596 | shadow_sami | Gondola (IOI14_gondola) | C++20 | 0 ms | 0 KiB |
#include "gondola.h"
#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 ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
#define ff first
#define ss second
#define fip(a,b) for(ll i = a ; i < b; i++)
#define fjp(a,b) for(ll j = a ; j < b; j++)
#define fp(k,a,b) for(ll k = a ; k < b; k++)
#define fin(a,b) for(ll i = a ; i >= b; i---)
#define fjn(a,b) for(ll j = a ; j >= b; j---)
#define fn(k,a,b) for(ll k = a ; k >= b; k---)
#define fx(a) for(auto x:a)
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define nli "\n"
#define test ll t;cin>>t;while(t--)
ll n,m,res,cnt,sum,tp,tp2,tptp;
int valid(int n, int inputSeq[]){
tp = -1;
fip(0,n){
if(tp!=-1)tp++;
if(tp>n)
tp = 1;
if(inputSeq[i] <= n){
if(tp==-1){
tp = inputSeq[i];
}else if(tp!=inputSeq[i])
return 0;
}
}
return 1;
}
// {
// return -2;
// }
// //----------------------
// int countReplacement(int n, int inputSeq[])
// {
// return -3;
// }
// #ifdef SAMI
// int gondolaSequence[100001];
// int replacementSequence[250001];
// int main()
// {
// freopen("input1.txt","r",stdin);
// freopen("output1.txt","w",stdout);
// freopen("error1.txt","w",stderr);
// int i, n, tag;
// int nr;
// assert(scanf("%d", &tag)==1);
// assert(scanf("%d", &n)==1);
// for(i=0;i< n;i++)
// assert( scanf("%d", &gondolaSequence[i]) ==1);
// switch (tag){
// case 1: case 2: case 3:
// printf("%d\n", valid(n, gondolaSequence));
// break;
// case 4: case 5: case 6:
// nr = replacement(n, gondolaSequence, replacementSequence);
// printf("%d ", nr);
// if (nr > 0)
// {
// for (i=0; i<nr-1; i++)
// printf("%d ", replacementSequence[i]);
// printf("%d\n", replacementSequence[nr-1]);
// }
// else printf("\n");
// break;
// case 7: case 8: case 9: case 10:
// printf("%d\n", countReplacement(n, gondolaSequence));
// break;
// }
// return 0;
// }
// #endif