QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#306251 | #7979. 棋盘 | hos_lyric# | 20 | 653ms | 13444kb | D | 2.3kb | 2024-01-16 16:26:09 | 2024-01-16 16:26:09 |
Judging History
answer
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
string COLOR(string s = "") { return "\x1b[" ~ s ~ "m"; }
bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }
int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }
void main() {
try {
for (; ; ) {
const L = readInt;
const Q = readInt;
const X = readInt;
const Y = readInt;
auto K = new BigInt[Q];
foreach (q; 0 .. Q) {
K[q] = BigInt(readToken);
}
enum E = 210;
alias Pt = Tuple!(int, "x", int, "y");
Pt[] ps;
auto ids = new int[3][E];
foreach (e; 0 .. E) {
ps ~= Pt(e + 0, 2*e + 0);
ps ~= Pt(e + 0, 2*e + 1);
ps ~= Pt(e + 0, 2*e + 2);
ids[e][1] = cast(int)(ps.length); ps ~= Pt(e + 1, 2*e + 0);
ids[e][2] = cast(int)(ps.length); ps ~= Pt(e + 1, 2*e + 1);
}
writeln(ps.length);
foreach (p; ps) {
writeln(p.x + 1, " ", p.y + 1);
}
foreach (q; 0 .. Q) {
auto ans = new char[ps.length];
ans[] = '0';
BigInt k = K[q];
foreach (e; 0 .. E) {
const r = k % 3;
k /= 3;
if (r) {
ans[ids[e][r]] = '1';
}
}
writeln(ans);
}
}
} catch (EOFException e) {
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 53ms
memory: 4104kb
input:
3 999 1000 340 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 1000]
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 520ms
memory: 4116kb
input:
12 10000 1000 340 358908473750 36343501002 904324605639 453955046266 725478753662 218319365131 882878650993 648345848966 474401697383 722377018680 718743783955 748051292505 167886140898 411111004914 327825244967 990026144963 623309580364 970889332700 319445927842 527624602835 453135227321 1153226125...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 1000]
Subtask #3:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 635ms
memory: 11384kb
input:
100 10000 1000 340 87490023455826213450979333037504606824522062808297739018786336978222089712660133428564103979384831 874900289913204769749000879539227331559680630241808944569515663934025397982898503777823815274323967 8749002899116133353924895735921513229471979456689635148877567298640178774668643967...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 1000]
Subtask #4:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 653ms
memory: 11468kb
input:
100 10000 990 310 4083451712318559926139496762164571032902328806667934236880329773320213539959944736095945843081512968 7811890641057562314768022152641517082686481268288006737090208624016586608183953908313798353213188661 97358161226180890688421784730819518002666166790210320310558753031161862165361257...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 990]
Subtask #5:
score: 10
Accepted
Test #9:
score: 10
Accepted
time: 646ms
memory: 11400kb
input:
100 10000 1050 260 8749002899132047697490008908470485461412677723566863434996575047286849703722697797645542008396185599 8749002899132047697490008908470485461412677699052921091826559946707718798046219210886366418022957055 7655377536740541735303757766642121742076255665128332760334129720709510994307378...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
ok correct
Test #10:
score: 0
Accepted
time: 646ms
memory: 13272kb
input:
100 10000 1050 260 8749002899132047697490008908470485461412677723572849745703082425639811996797503692892926808185372671 874900289913204769701566661490981966686019183484759731181812123183820701469425350909196577361887231 87490028991280691115987306153332424033768113943575511927837611721527450026923859...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
ok correct
Subtask #6:
score: 10
Accepted
Test #11:
score: 10
Accepted
time: 647ms
memory: 13444kb
input:
100 10000 1050 240 8749002899132047697490008908470485461412677723572849734285100881333676956761384191490477496469520383 874886939179415873527191365288672777702448917037688119492655525651250910013304087281579324577152991 87490028991320476974900089084704854614126777235728490149522637601883528949454159...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
ok correct
Test #12:
score: 0
Accepted
time: 652ms
memory: 11424kb
input:
100 10000 1050 240 8748869399942302640609859219613849864404711585518072959767189754493152526763381301362784876544131071 8749002898113529709322765865336262617207988643047115548870114300321741770881768540817196765514039295 8749002899132047697490008908470485448242213512826165447361161116479336307579296...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
ok correct
Subtask #7:
score: 0
Wrong Answer
Test #13:
score: 0
Wrong Answer
time: 1ms
memory: 2980kb
input:
100 1 980 260 8749002899132047697490008908470485461309833682610292204604841418296589481615503153703163411103219711
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 980]
Subtask #8:
score: 0
Wrong Answer
Test #19:
score: 0
Wrong Answer
time: 628ms
memory: 11432kb
input:
100 10000 960 240 8749002899132047697015724510954438324957730968977252383122989921226002617013223698533483281626692607 8749002899132047697490008908470485461412677720507858663971304708923117942496885325656574463725010943 87148271065573131361716885470369961093519598137825155235803895087505468828694702...
output:
1050 1 1 1 2 1 3 2 1 2 2 2 3 2 4 2 5 3 3 3 4 3 5 3 6 3 7 4 5 4 6 4 7 4 8 4 9 5 7 5 8 5 9 5 10 5 11 6 9 6 10 6 11 6 12 6 13 7 11 7 12 7 13 7 14 7 15 8 13 8 14 8 15 8 16 8 17 9 15 9 16 9 17 9 18 9 19 10 17 10 18 10 19 10 20 10 21 11 19 11 20 11 21 11 22 11 23 12 21 12 22 12 23 12 24 12 25 13 23 13 24 ...
result:
wrong answer Integer 1050 violates the range [1, 960]