#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("trapv")
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define pp(x) pop_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)
using namespace std;
///~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename H, typename T>
ostream& operator<<(ostream& os, pair<H, T> m){
return os <<"("<< m.st<<", "<<m.nd<<")";
}
template <typename H>
ostream& operator<<(ostream& os, vector<H> V){
os<<"{";
for(int i=0; i<V.size(); i++){
if(i)os<<" ";
os<<V[i];
}
os<<"}";
return os;
}
void debug(){cerr<<"\n";}
template <typename H, typename... T>
void debug(H h, T... t) {cerr<<h; if (sizeof...(t)) cerr << ", "; debug(t...);}
#define deb(x...) cerr<<#x<<" = ";debug(x);
//#define deb(x...) ;
///~~~~~~~~~~~~~~~~~~~~~~~~~
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include "Annalib.h"
void Anna( int n, long long X, int K, int P[] ){
X--;
srand(24636346);
vi kol(n), co(n);
iota(all(kol), 0);
random_shuffle(all(kol));
vi val(n);
int blo=6;
int pot=1000;
for(int i=0; i<n; i++){
val[i]=rand()%pot;
co[kol[i]]=i;
}
for(int i=0; i<K; i++){
val[kol[P[i]]]=0;
}
vi ans(n);
for(int i=0; i<blo; i++){
//deb(i);
int reszta=X%pot;
X/=pot;
vi tim(pot, 1e9);
tim[0]=-1;
for(int j=i*n/blo; j<(i+1)*n/blo; j++){
int t=val[j];
//deb(t);
for(int i=t; i<pot; i++){
if(tim[i]==1e9 && tim[i-t]<j)tim[i]=j;
}
for(int i=0; i<t; i++){
if(tim[i]==1e9 && tim[i+pot-t]<j)tim[i]=j;
}
if(tim[reszta]!=1e9){
//deb("a");
break;
}
}
while(reszta){
deb(reszta);
ans[co[tim[reszta]]]=1;
int t=val[tim[reszta]];
reszta=(reszta+pot-t)%pot;
}
}
for( int i = 0; i < n; i++ ){
Set( i, ans[i] );
}
}
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
//#pragma GCC optimize("trapv")
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define pp(x) pop_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)
using namespace std;
///~~~~~~~~~~~~~~~~~~~~~~~~~
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;
#include "Brunolib.h"
long long Bruno( int n, int A[] ){
srand(24636346);
vi kol(n), co(n);
iota(all(kol), 0);
random_shuffle(all(kol));
vi val(n);
int blo=6;
int pot=1000;
for(int i=0; i<n; i++){
val[i]=rand()%pot;
co[kol[i]]=i;
}
ll ans=0;
for(int i=blo-1; i>=0; i--){
ans*=pot;
int reszta=0;
for(int j=i*n/blo; j<(i+1)*n/blo; j++){
if(A[co[j]]){
reszta+=val[j];
}
}
ans+=reszta;
}
return ans+1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
468 KB |
Execution killed with signal 11 |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
4 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
5 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
6 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
7 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
8 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
9 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
10 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
11 |
Runtime error |
6 ms |
468 KB |
Execution killed with signal 11 |
12 |
Runtime error |
4 ms |
460 KB |
Execution killed with signal 11 |
13 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
14 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
15 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
16 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
17 |
Runtime error |
6 ms |
468 KB |
Execution killed with signal 11 |
18 |
Runtime error |
2 ms |
340 KB |
Execution killed with signal 11 |
19 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
20 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
21 |
Runtime error |
6 ms |
468 KB |
Execution killed with signal 11 |
22 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
23 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
24 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
25 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
26 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
27 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
28 |
Runtime error |
5 ms |
468 KB |
Execution killed with signal 11 |
29 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
30 |
Runtime error |
5 ms |
460 KB |
Execution killed with signal 11 |
31 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
32 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
33 |
Runtime error |
4 ms |
468 KB |
Execution killed with signal 11 |
34 |
Runtime error |
6 ms |
468 KB |
Execution killed with signal 11 |
35 |
Runtime error |
5 ms |
468 KB |
Execution killed with signal 11 |
36 |
Runtime error |
4 ms |
468 KB |
Execution killed with signal 11 |
37 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
38 |
Runtime error |
5 ms |
468 KB |
Execution killed with signal 11 |
39 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
40 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |