답안 #925452

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
925452 2024-02-11T16:29:11 Z ttamx Ancient Machine 2 (JOI23_ancient2) C++17
37 / 100
1683 ms 1500 KB
#include "ancient2.h"
#include<bits/stdc++.h>

using namespace std;

string solve_left(int n){
	string ans(n,'0');
	int m=n+2;
	vector<int> a(m),b(m);
	a[n]=b[n]=n;
	a[n+1]=b[n+1]=n+1;
	for(int i=0;i<n;i++){
		a[i]=n;
		b[i]=n+1;
	}
	for(int i=0;i<n;i++){
		int res=Query(m,a,b);
		ans[i]=res-n+'0';
		a[i]=b[i]=i+1;
	}
	cerr << ans << "\n";
	return ans;
}

string solve_right(int n){
	string ans(n,'0');
	string suf="";
	for(int i=0;i<n;i++){
		suf="1"+suf;
		int m=i+2;
		vector<vector<int>> a(2,vector<int>(m));
		for(int j=0;j<m;j++){
			for(int c=0;c<2;c++){
				int sz=min(j+1,i+1);
				while(sz>0&&(suf.substr(j-sz+1,sz-1)+char('0'+c))!=suf.substr(0,sz)){
					sz--;
				}
				a[c][j]=sz;
			}
		}
		int res=Query(m,a[0],a[1]);
		res=(res==i+1);
		ans[n-i-1]=res+'0';
		suf[0]=res+'0';
	}
	cerr << ans << "\n";
	return ans;
}

string Solve(int n) {
	return solve_left(n/2)+solve_right((n+1)/2);
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1616 ms 1500 KB Output is partially correct
2 Partially correct 1611 ms 1224 KB Output is partially correct
3 Partially correct 1632 ms 792 KB Output is partially correct
4 Partially correct 1633 ms 1056 KB Output is partially correct
5 Partially correct 1623 ms 796 KB Output is partially correct
6 Partially correct 1625 ms 1312 KB Output is partially correct
7 Partially correct 1626 ms 804 KB Output is partially correct
8 Partially correct 1628 ms 716 KB Output is partially correct
9 Partially correct 1624 ms 1044 KB Output is partially correct
10 Partially correct 1618 ms 1048 KB Output is partially correct
11 Partially correct 1675 ms 796 KB Output is partially correct
12 Partially correct 1683 ms 1024 KB Output is partially correct
13 Partially correct 1661 ms 1052 KB Output is partially correct
14 Partially correct 1636 ms 780 KB Output is partially correct
15 Partially correct 1593 ms 808 KB Output is partially correct
16 Partially correct 1651 ms 556 KB Output is partially correct
17 Partially correct 1649 ms 640 KB Output is partially correct
18 Partially correct 1616 ms 968 KB Output is partially correct
19 Partially correct 1611 ms 1300 KB Output is partially correct
20 Partially correct 1591 ms 816 KB Output is partially correct
21 Partially correct 1604 ms 552 KB Output is partially correct
22 Partially correct 1615 ms 792 KB Output is partially correct
23 Partially correct 1608 ms 748 KB Output is partially correct
24 Partially correct 1629 ms 1236 KB Output is partially correct
25 Partially correct 1611 ms 556 KB Output is partially correct
26 Partially correct 1609 ms 984 KB Output is partially correct
27 Partially correct 1611 ms 552 KB Output is partially correct
28 Partially correct 1632 ms 808 KB Output is partially correct
29 Partially correct 1615 ms 1048 KB Output is partially correct
30 Partially correct 1610 ms 552 KB Output is partially correct
31 Partially correct 1625 ms 1052 KB Output is partially correct
32 Partially correct 1618 ms 1040 KB Output is partially correct
33 Partially correct 1611 ms 1220 KB Output is partially correct
34 Partially correct 1624 ms 1300 KB Output is partially correct
35 Partially correct 1595 ms 748 KB Output is partially correct
36 Partially correct 1599 ms 756 KB Output is partially correct
37 Partially correct 1628 ms 768 KB Output is partially correct
38 Partially correct 1620 ms 764 KB Output is partially correct
39 Partially correct 1627 ms 792 KB Output is partially correct
40 Partially correct 1642 ms 808 KB Output is partially correct
41 Partially correct 1617 ms 804 KB Output is partially correct
42 Partially correct 1616 ms 1300 KB Output is partially correct
43 Partially correct 1513 ms 992 KB Output is partially correct
44 Partially correct 1619 ms 1224 KB Output is partially correct
45 Partially correct 1625 ms 804 KB Output is partially correct
46 Partially correct 1609 ms 560 KB Output is partially correct
47 Partially correct 1611 ms 768 KB Output is partially correct
48 Partially correct 1622 ms 808 KB Output is partially correct
49 Partially correct 1617 ms 1228 KB Output is partially correct
50 Partially correct 1618 ms 772 KB Output is partially correct
51 Partially correct 1613 ms 800 KB Output is partially correct
52 Partially correct 1621 ms 812 KB Output is partially correct
53 Partially correct 1629 ms 604 KB Output is partially correct
54 Partially correct 1609 ms 976 KB Output is partially correct
55 Partially correct 1634 ms 984 KB Output is partially correct
56 Partially correct 1615 ms 792 KB Output is partially correct
57 Partially correct 1594 ms 1500 KB Output is partially correct
58 Partially correct 1635 ms 788 KB Output is partially correct
59 Partially correct 1550 ms 760 KB Output is partially correct
60 Partially correct 1641 ms 744 KB Output is partially correct
61 Partially correct 1617 ms 1232 KB Output is partially correct
62 Partially correct 1621 ms 1048 KB Output is partially correct
63 Partially correct 1625 ms 976 KB Output is partially correct