답안 #793422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
793422 2023-07-25T20:05:31 Z Antekb Broken Device (JOI17_broken_device) C++17
0 / 100
189 ms 2604 KB
#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[] ){
	srand(24636346);
	vi kol(n), co(n);
	iota(all(kol), 0);
	random_shuffle(all(kol));
	vi val(n);
	int blo=6;
	int pot=1001;
	for(int i=0; i<n; i++){
		val[i]=rand()%pot;
		co[kol[i]]=i;
	}
	for(int i=0; i<K; i++){
		//deb(kol[P[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, j);
			for(int k=t; k<pot; k++){
				if(tim[k]==1e9 && tim[k-t]<j)tim[k]=j;
			}
			for(int k=0; k<t; k++){
				if(tim[k]==1e9 && tim[k+pot-t]<j)tim[k]=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=1001;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 164 ms 2472 KB Output isn't correct - L* = 0
2 Partially correct 168 ms 2464 KB Output isn't correct - L* = 0
3 Runtime error 12 ms 488 KB Execution killed with signal 11
4 Partially correct 162 ms 2400 KB Output isn't correct - L* = 0
5 Runtime error 11 ms 468 KB Execution killed with signal 11
6 Partially correct 160 ms 2496 KB Output isn't correct - L* = 0
7 Runtime error 13 ms 464 KB Execution killed with signal 11
8 Runtime error 105 ms 1372 KB Execution killed with signal 11
9 Runtime error 85 ms 1136 KB Execution killed with signal 11
10 Partially correct 167 ms 2372 KB Output isn't correct - L* = 0
11 Partially correct 163 ms 2344 KB Output isn't correct - L* = 0
12 Runtime error 36 ms 716 KB Execution killed with signal 11
13 Partially correct 163 ms 2372 KB Output isn't correct - L* = 0
14 Partially correct 162 ms 2468 KB Output isn't correct - L* = 0
15 Runtime error 52 ms 876 KB Execution killed with signal 11
16 Runtime error 138 ms 1644 KB Execution killed with signal 11
17 Partially correct 162 ms 2320 KB Output isn't correct - L* = 0
18 Runtime error 105 ms 1356 KB Execution killed with signal 11
19 Partially correct 166 ms 2440 KB Output isn't correct - L* = 0
20 Partially correct 163 ms 2552 KB Output isn't correct - L* = 0
21 Partially correct 162 ms 2372 KB Output isn't correct - L* = 0
22 Partially correct 162 ms 2392 KB Output isn't correct - L* = 0
23 Runtime error 12 ms 468 KB Execution killed with signal 11
24 Partially correct 189 ms 2368 KB Output isn't correct - L* = 0
25 Runtime error 93 ms 1188 KB Execution killed with signal 11
26 Runtime error 38 ms 756 KB Execution killed with signal 11
27 Runtime error 14 ms 472 KB Execution killed with signal 11
28 Runtime error 57 ms 928 KB Execution killed with signal 11
29 Runtime error 21 ms 596 KB Execution killed with signal 11
30 Partially correct 164 ms 2396 KB Output isn't correct - L* = 0
31 Runtime error 60 ms 1132 KB Execution killed with signal 11
32 Partially correct 165 ms 2376 KB Output isn't correct - L* = 0
33 Runtime error 5 ms 468 KB Execution killed with signal 11
34 Partially correct 165 ms 2348 KB Output isn't correct - L* = 0
35 Partially correct 165 ms 2396 KB Output isn't correct - L* = 0
36 Partially correct 166 ms 2604 KB Output isn't correct - L* = 0
37 Runtime error 67 ms 1012 KB Execution killed with signal 11
38 Partially correct 162 ms 2496 KB Output isn't correct - L* = 0
39 Partially correct 161 ms 2364 KB Output isn't correct - L* = 0
40 Runtime error 2 ms 340 KB Execution killed with signal 11