#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
struct greateri
{
template<class T>
bool operator()(T const &a, T const &b) const { return a > b; }
};
map<int,vector<int>>rafa;
vector<pair<int,pair<int,int>>>switchi[100001];
map<int,int>tabi;
map<int,int>win;
void create_circuit(int M,vector<int>A)
{
//flash;
int last=-1;
vector<int>C;
vector<int>X;
vector<int>Y;
C.resize(M+1);
for (int i = 0; i < A.size(); ++i)
{
tabi[A[i]]++;
rafa[A[i]].pb(A[i+1]);
}
C[0]=A[0];
for(auto it:tabi)
{
if(it.second==1)
{
C[it.first]=rafa[it.first][0];
}
else if(it.second==2)
{
//switchi[i].pb({last,{0,0}});
X.pb(rafa[it.first][0]);
Y.pb(rafa[it.first][1]);
C[it.first]=last;
last--;
}
else if(it.second==3)
{
//switchi[i].pb({last,{0,0}});
X.pb(last-1);
Y.pb(last-2);
C[it.first]=last;
last--;
//switchi[i].pb({last,{0,0}});
X.pb(rafa[it.first][0]);
Y.pb(last+1);
last--;
//switchi[i].pb({last,{0,0}});
X.pb(rafa[it.first][1]);
Y.pb(rafa[it.first][2]);
last--;
}
else if(it.second==4)
{
//switchi[i].pb({last,{0,0}});
X.pb(last-1);
Y.pb(last-2);
C[it.first]=last;
last--;
//switchi[i].pb({last,{0,0}});
X.pb(rafa[it.first][0]);
Y.pb(rafa[it.first][2]);
last--;
//switchi[i].pb({last,{0,0}});
X.pb(rafa[it.first][1]);
Y.pb(rafa[it.first][3]);
last--;
}
}
answer(C,X,Y);
return ;
}
//code the AC sol !
// BS/queue/map
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:32:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int i = 0; i < A.size(); ++i)
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
135 ms |
14580 KB |
Output is correct |
3 |
Correct |
92 ms |
14108 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
13 ms |
3788 KB |
Output is correct |
6 |
Correct |
221 ms |
20204 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
135 ms |
14580 KB |
Output is correct |
3 |
Correct |
92 ms |
14108 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
13 ms |
3788 KB |
Output is correct |
6 |
Correct |
221 ms |
20204 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
193 ms |
16228 KB |
Output is correct |
9 |
Correct |
257 ms |
19628 KB |
Output is correct |
10 |
Correct |
409 ms |
23608 KB |
Output is correct |
11 |
Correct |
3 ms |
2636 KB |
Output is correct |
12 |
Correct |
3 ms |
2636 KB |
Output is correct |
13 |
Correct |
3 ms |
2548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2636 KB |
Output is correct |
2 |
Correct |
135 ms |
14580 KB |
Output is correct |
3 |
Correct |
92 ms |
14108 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
13 ms |
3788 KB |
Output is correct |
6 |
Correct |
221 ms |
20204 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
193 ms |
16228 KB |
Output is correct |
9 |
Correct |
257 ms |
19628 KB |
Output is correct |
10 |
Correct |
409 ms |
23608 KB |
Output is correct |
11 |
Correct |
3 ms |
2636 KB |
Output is correct |
12 |
Correct |
3 ms |
2636 KB |
Output is correct |
13 |
Correct |
3 ms |
2548 KB |
Output is correct |
14 |
Correct |
341 ms |
20140 KB |
Output is correct |
15 |
Correct |
140 ms |
11436 KB |
Output is correct |
16 |
Correct |
217 ms |
16092 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
3 ms |
2636 KB |
Output is correct |
19 |
Correct |
2 ms |
2636 KB |
Output is correct |
20 |
Correct |
322 ms |
20940 KB |
Output is correct |
21 |
Correct |
2 ms |
2636 KB |
Output is correct |
22 |
Correct |
4 ms |
2636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
2636 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2636 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
2636 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |