Submission #925458

# Submission time Handle Problem Language Result Execution time Memory
925458 2024-02-11T16:46:25 Z ttamx Ancient Machine 2 (JOI23_ancient2) C++17
37 / 100
1702 ms 1468 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;
	}
	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';
	}
	return ans;
}
 
string Solve(int n) {
	return solve_left(n/2)+solve_right((n+1)/2);
}
# Verdict Execution time Memory Grader output
1 Partially correct 1593 ms 796 KB Output is partially correct
2 Partially correct 1592 ms 780 KB Output is partially correct
3 Partially correct 1580 ms 960 KB Output is partially correct
4 Partially correct 1614 ms 968 KB Output is partially correct
5 Partially correct 1636 ms 768 KB Output is partially correct
6 Partially correct 1626 ms 1048 KB Output is partially correct
7 Partially correct 1570 ms 796 KB Output is partially correct
8 Partially correct 1621 ms 556 KB Output is partially correct
9 Partially correct 1633 ms 796 KB Output is partially correct
10 Partially correct 1702 ms 552 KB Output is partially correct
11 Partially correct 1688 ms 752 KB Output is partially correct
12 Partially correct 1543 ms 796 KB Output is partially correct
13 Partially correct 1544 ms 796 KB Output is partially correct
14 Partially correct 1542 ms 1056 KB Output is partially correct
15 Partially correct 1527 ms 552 KB Output is partially correct
16 Partially correct 1582 ms 796 KB Output is partially correct
17 Partially correct 1624 ms 600 KB Output is partially correct
18 Partially correct 1574 ms 964 KB Output is partially correct
19 Partially correct 1568 ms 796 KB Output is partially correct
20 Partially correct 1545 ms 548 KB Output is partially correct
21 Partially correct 1561 ms 1288 KB Output is partially correct
22 Partially correct 1583 ms 804 KB Output is partially correct
23 Partially correct 1564 ms 804 KB Output is partially correct
24 Partially correct 1562 ms 872 KB Output is partially correct
25 Partially correct 1568 ms 1052 KB Output is partially correct
26 Partially correct 1544 ms 720 KB Output is partially correct
27 Partially correct 1556 ms 812 KB Output is partially correct
28 Partially correct 1545 ms 716 KB Output is partially correct
29 Partially correct 1532 ms 1056 KB Output is partially correct
30 Partially correct 1542 ms 1284 KB Output is partially correct
31 Partially correct 1549 ms 756 KB Output is partially correct
32 Partially correct 1565 ms 792 KB Output is partially correct
33 Partially correct 1549 ms 800 KB Output is partially correct
34 Partially correct 1532 ms 1044 KB Output is partially correct
35 Partially correct 1541 ms 808 KB Output is partially correct
36 Partially correct 1534 ms 1280 KB Output is partially correct
37 Partially correct 1538 ms 1008 KB Output is partially correct
38 Partially correct 1564 ms 780 KB Output is partially correct
39 Partially correct 1540 ms 976 KB Output is partially correct
40 Partially correct 1544 ms 796 KB Output is partially correct
41 Partially correct 1539 ms 800 KB Output is partially correct
42 Partially correct 1548 ms 812 KB Output is partially correct
43 Partially correct 1557 ms 800 KB Output is partially correct
44 Partially correct 1551 ms 708 KB Output is partially correct
45 Partially correct 1563 ms 720 KB Output is partially correct
46 Partially correct 1549 ms 768 KB Output is partially correct
47 Partially correct 1548 ms 964 KB Output is partially correct
48 Partially correct 1563 ms 1468 KB Output is partially correct
49 Partially correct 1544 ms 808 KB Output is partially correct
50 Partially correct 1530 ms 568 KB Output is partially correct
51 Partially correct 1556 ms 636 KB Output is partially correct
52 Partially correct 1549 ms 792 KB Output is partially correct
53 Partially correct 1557 ms 800 KB Output is partially correct
54 Partially correct 1562 ms 984 KB Output is partially correct
55 Partially correct 1610 ms 1004 KB Output is partially correct
56 Partially correct 1561 ms 980 KB Output is partially correct
57 Partially correct 1550 ms 800 KB Output is partially correct
58 Partially correct 1547 ms 792 KB Output is partially correct
59 Partially correct 1496 ms 1292 KB Output is partially correct
60 Partially correct 1543 ms 784 KB Output is partially correct
61 Partially correct 1542 ms 988 KB Output is partially correct
62 Partially correct 1545 ms 708 KB Output is partially correct
63 Partially correct 1515 ms 548 KB Output is partially correct