# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
292018 |
2020-09-06T08:01:45 Z |
khangal |
Gondola (IOI14_gondola) |
C++14 |
|
49 ms |
31272 KB |
#include<bits/stdc++.h>
#include "gondola.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef int ll;
typedef double db;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define BOOST ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
#define read(x) scanf("%lld",&x);
#define print(x) printf("%lld ",x);
#define endl '\n';
typedef tree<ll , null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_multi_set;
typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int n,m,ans,mid,mn,mx,cnt,T,sum,h1,h2,e[1234567],b,c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z,t;
bool used[1234567];
pair<int,int> p[1234567];
vector<pl> vc[1234567];
vl vec,vv1,vv2;
// string s1,s;
// int sz[1234567],par[1234567];
int tr[5234567],par[1234567],maxx;
ll dx[4]={-1,1,0,0},dy[4]={0,0,-1,1},c1[123][123];
map<ll,ll> mp;
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
int valid(int n, int inputSeq[])
{
int res=1;
vector<pl> vec;
vl vv;
for(int i=0;i<n;i++){
if(inputSeq[i]<=n)vec.pb({inputSeq[i],i});
vv.pb(inputSeq[i]);
}
sort(vv.begin(),vv.end());
for(int i=1;i<vv.size();i++){
if(vv[i]==vv[i-1])res=0;
}
sort(vec.begin(),vec.end());
for(int i=1;i<vec.size();i++){
if ( vec [ i ] . first - vec [ i - 1 ] . first != ( ( vec [ i ] . second - vec [ i - 1 ] . second ) % n + n ) % n ) {
res=0;
}
}
return res;
}
Compilation message
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:72:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
72 | for(int i=1;i<vv.size();i++){
| ~^~~~~~~~~~
gondola.cpp:76:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
76 | for(int i=1;i<vec.size();i++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
29304 KB |
Output is correct |
2 |
Correct |
20 ms |
29312 KB |
Output is correct |
3 |
Correct |
20 ms |
29312 KB |
Output is correct |
4 |
Correct |
20 ms |
29312 KB |
Output is correct |
5 |
Correct |
20 ms |
29312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
29312 KB |
Output is correct |
2 |
Correct |
23 ms |
29312 KB |
Output is correct |
3 |
Correct |
20 ms |
29312 KB |
Output is correct |
4 |
Correct |
22 ms |
29312 KB |
Output is correct |
5 |
Correct |
20 ms |
29312 KB |
Output is correct |
6 |
Correct |
32 ms |
30196 KB |
Output is correct |
7 |
Correct |
49 ms |
31272 KB |
Output is correct |
8 |
Correct |
38 ms |
31164 KB |
Output is correct |
9 |
Correct |
27 ms |
29816 KB |
Output is correct |
10 |
Correct |
46 ms |
31224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
29344 KB |
Output is correct |
2 |
Correct |
21 ms |
29312 KB |
Output is correct |
3 |
Correct |
20 ms |
29312 KB |
Output is correct |
4 |
Correct |
20 ms |
29312 KB |
Output is correct |
5 |
Correct |
20 ms |
29312 KB |
Output is correct |
6 |
Correct |
35 ms |
30196 KB |
Output is correct |
7 |
Correct |
48 ms |
31220 KB |
Output is correct |
8 |
Correct |
37 ms |
31088 KB |
Output is correct |
9 |
Correct |
27 ms |
29824 KB |
Output is correct |
10 |
Correct |
47 ms |
31216 KB |
Output is correct |
11 |
Correct |
20 ms |
29312 KB |
Output is correct |
12 |
Correct |
20 ms |
29312 KB |
Output is correct |
13 |
Correct |
30 ms |
30080 KB |
Output is correct |
14 |
Correct |
20 ms |
29312 KB |
Output is correct |
15 |
Correct |
48 ms |
31220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
29312 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
29312 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
29312 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
29312 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
29312 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
29376 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
29312 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |