QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#31145 | #3961. Glitching screen | perspective | AC ✓ | 311ms | 45024kb | Java11 | 3.2kb | 2022-05-03 20:28:27 | 2022-05-03 20:28:32 |
Judging History
answer
import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class brigt {
public static void main(String[] args) {
KattioTrains in = new KattioTrains(System.in);
int h = in.getInt();
int w = in.getInt();
int n = in.getInt();
final char ACTIVE = 'x';
final char OFF = '.';
boolean[][][] allData = new boolean[n][h][w];
for (int i = 0; i < n; i++) {
for (int y = 0; y < h; y++) {
String line = in.getWord();
for (int x = 0; x < w; x++) {
allData[i][y][x] = line.charAt(x) == ACTIVE;
}
}
}
boolean[] matchingStops = new boolean[n];
for (int i = 0; i < n; i++) {
matchingStops[i] = true;
}
int left_to_be_matched = n;
boolean done = false;
for (int y = 0; y < h; y++) {
String line = in.getWord();
for (int x = 0; x < w; x++) {
if(line.charAt(x) == ACTIVE) {
for (int i = 0; i < n; i++) {
if(matchingStops[i]){
if(!allData[i][y][x]){
matchingStops[i] = false;
left_to_be_matched--;
}
}
}
if(left_to_be_matched <= 1){
done = true;
break;
}
}
}
if(done){
break;
}
}
if(done){
System.out.println("yes");
} else {
System.out.println("no");
}
}
}
class KattioTrains extends PrintWriter {
public KattioTrains(InputStream i) {
super(new BufferedOutputStream(System.out));
r = new BufferedReader(new InputStreamReader(i));
}
public KattioTrains(InputStream i, OutputStream o) {
super(new BufferedOutputStream(o));
r = new BufferedReader(new InputStreamReader(i));
}
public boolean hasMoreTokens() {
return peekToken() != null;
}
public int getInt() {
return Integer.parseInt(nextToken());
}
public double getDouble() {
return Double.parseDouble(nextToken());
}
public long getLong() {
return Long.parseLong(nextToken());
}
public String getWord() {
return nextToken();
}
private BufferedReader r;
private String line;
private StringTokenizer st;
private String token;
private String peekToken() {
if (token == null)
try {
while (st == null || !st.hasMoreTokens()) {
line = r.readLine();
if (line == null) return null;
st = new StringTokenizer(line);
}
token = st.nextToken();
} catch (IOException e) { }
return token;
}
private String nextToken() {
String ans = peekToken();
token = null;
return ans;
}
}
详细
Test #1:
score: 100
Accepted
time: 99ms
memory: 37888kb
input:
3 9 2 x.x.x.xxx xxx.x..x. x.x.x..x. xx..x.xxx x.x.x..x. xx..x..x. ....x.... .x..x.... ....x....
output:
yes
result:
ok single line: 'yes'
Test #2:
score: 0
Accepted
time: 102ms
memory: 38264kb
input:
1 4 2 x.xx xx.x x..x
output:
no
result:
ok single line: 'no'
Test #3:
score: 0
Accepted
time: 102ms
memory: 38400kb
input:
3 3 1 .xx xxx x.. .x. xxx ...
output:
yes
result:
ok single line: 'yes'
Test #4:
score: 0
Accepted
time: 117ms
memory: 38664kb
input:
3 3 6 x.x xxx .xx ... .x. ... ..x ... ... ... x.. ... ... x.. ... ... ... ... x.x xxx .x.
output:
yes
result:
ok single line: 'yes'
Test #5:
score: 0
Accepted
time: 96ms
memory: 38112kb
input:
10 10 100 ..xxx.xxxx xxxxxxxx.x xxxxxxx.xx .xx.xxxxxx xxxxxxxxxx xxxx.xxxxx xx...xx.xx .x.xx.xxx. xxx.xxx.x. xxxxxxxxxx ..x....... .......... .xx....... .......... .......... .......xx. .....x..x. ...x..x.x. ....xx.... x....x.... .......x.. x......... .......... .......... .......... ..x....x.. .x.....
output:
yes
result:
ok single line: 'yes'
Test #6:
score: 0
Accepted
time: 311ms
memory: 44988kb
input:
100 100 100 xxxxxx.xxxxx.xxxx..xxx.xxxx.xx..x.xxxxxxx..xx.xxxxxxxxxxxxxxxxx..xx.x.xxxxxxxxx.xxxxxxxx.xxxxxx.xxxx xxx..x.x.xxxxxxxxxx..xxxxxxxxx..xxxxx.x.xx.x.xxxx.xxxx...x.x.xxxxxxxxxxxx.xxxxxxxxxxxxxx.xxxxx...xxx .x.xxxx.xxxxxx.xxxx.x.xxxxxxxxx.xxxxxxxxxxx.xxxxxxx.xxxx..x.x.x.xx..xxx.x.xxxxxxxxxxxx...
output:
yes
result:
ok single line: 'yes'
Test #7:
score: 0
Accepted
time: 301ms
memory: 45024kb
input:
100 100 100 xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxx.x.xxxxxxxxxxx.xxxxxx.xxxxxxxxxxxxx.xxxx.xxxxxxx.xxxx.xxxx.xxxx xx.xxx.xx.xxxxx...xxxxxx.xxx..xxxx.xxxxxxxxxxxxxx.xxxxxxxxxxxx..xxxxx.xxxxxx.xxx.xxxxxxxxxxxxx.xx..x .xxxxxxx..xx.xxxx.xxx.x.xxx..xxxxx.xxxx...xxx.xxx.xxxxxxxx.xx.xxxxxxxxxxxxx.x.xxx.xx.x...
output:
yes
result:
ok single line: 'yes'
Test #8:
score: 0
Accepted
time: 108ms
memory: 38156kb
input:
3 3 100 .xx x.x .xx ... ... .xx ... ... .x. ... ... ... ... x.x .xx ... ... ... ... ..x ... ... ... .xx ... ..x .x. ... ... .xx ... ... ... .xx x.x .xx ..x x.x .x. ... ... ... .x. ... ... ... ... ... ... ... ... ... ... ... ... ... .x. ... ... .x. ... ..x ... ..x x.. ... .x. ... ... ... ... ... .x. ...
output:
no
result:
ok single line: 'no'
Test #9:
score: 0
Accepted
time: 102ms
memory: 38264kb
input:
10 10 100 xxxxxxxxxx xxxxxxx.x. xxxxxxx.xx xxxxx.xxx. xxxxxxxxx. xx..xx..x. xxx.xx..xx xx.xxx.xxx xxxx.xxxxx xx..xxxxxx ..xx...... .......... ........x. .x..x...x. .x.x...... ....x...x. ..x....... .......... .......... ....x..... .......x.. .......... x..xx..... x......... ........x. .......... .......
output:
no
result:
ok single line: 'no'
Test #10:
score: 0
Accepted
time: 238ms
memory: 43244kb
input:
100 100 50 x....x.xxxxxxxx..xxxxxxx..x.xxxxxxxx..x.xxxx..xxxxxxxxx.xxxx.xxxx.xxxxxx.xxxxxxx.xxxxx.xxxxxxxx.xx.x .xxxxx.x.xxx.xxx.xxxxxxxxxxxxx.x.x.x.xxxxx.xxxxxx.xxx.xx.xxx.xx.xx.xxx.xxxx.xxxxx.xxxx.xxxx.xxxx.xxx xxxxxxx.x.xx..x.x.xx.xxx.xxxx.xx.x.xxx.xx.xxxx..xxxxxxxxx.xxx..xxx..xx.xxxxxxxxx..xxx.x...
output:
no
result:
ok single line: 'no'
Test #11:
score: 0
Accepted
time: 172ms
memory: 38788kb
input:
30 30 70 xx.xxxxxxxxxxxxx.xxx.xxxxxxx.. xx.x.xxxx..x.x.x.xxxx.xx.xxxxx xx.xx.xxxx.xxxxx...xxxxxxxx..x xx.x.x.xx...xxxxxx.x.xxxxxxxxx x.xxx.xxxxxx.xxxxxxxxxx.xxxxxx .x..xx.xxxxxxxx.xxxxx.xxxxx..x x.x..xxxxxx.xxxx..xx.xx.x..x.x xxxxxx.x.xxxxxx.xxxxxxxxxx..xx .xxxxxxxxxx..xxxxxxxxxxxxx.xxx x.xxxxxxx.xx...
output:
no
result:
ok single line: 'no'
Test #12:
score: 0
Accepted
time: 121ms
memory: 38008kb
input:
10 10 10 xxxxxxxxxx xxxxxxxxxx xxxx.xxxxx xxxxxxx.x. xxxxxxxxxx x.xxxxxx.x xxxxxxxxxx xx.xxxx.xx xxxxx.xxxx .xxxx.xxxx .x.x...... ...x.....x .......... ..x..x.... .....x.x.. .......... ....x.x... .x......x. .......... .x........ .....x.... x..xx...xx .......... .......... .x.xx.xx.. x.x.x..... ........
output:
yes
result:
ok single line: 'yes'
Test #13:
score: 0
Accepted
time: 121ms
memory: 37912kb
input:
10 10 10 .xxx..xxxx xxxxx...xx xxxxxxxxxx xxx.xxxxx. .xxxxxxxxx xxxxxxx.xx xxxxxx.xxx .xxxxxxxxx x.xxxxxxxx x..x.xxxxx ...x...... .......... .......x.. .x........ .......... ....xx.... .........x .........x x........x ......xx.. .......x.. ..x....... x.....x.x. .xx....... ....x..... ...x.....x x.......
output:
yes
result:
ok single line: 'yes'
Test #14:
score: 0
Accepted
time: 82ms
memory: 38012kb
input:
10 10 10 .xxx.x.xx. xxxxxxxxxx .xxxxxxxxx x.xx.xxxxx x.xxxxx.xx x.xxxxxxxx xxx.xxxxxx x.xxxx.xxx .xxxx.xxxx xxx.xxxxxx ...x.x.... .xx.....x. ...x....x. ...x...... x........x ...xx..x.x .......... ...x...... .......xx. x......... .......xx. .x...x.... .......... ...x.xx..x ......x... .......... ........
output:
yes
result:
ok single line: 'yes'
Test #15:
score: 0
Accepted
time: 89ms
memory: 38064kb
input:
10 10 10 xxxx.x.xxx xxxxxxxxxx xx..x.xx.x .xxx.xx.xx .x.xxxx.xx xxxxxxxxxx .xxxxxxxxx xx.xx.xx.x xxxxxxxxx. x.xxxxxxxx .......x.. .x........ .......... ......x... ....x..... .......... .......... x......... ......x... x.x.....x. ...x.....x ..xx...... .x....xx.. ......x... .x........ ..x.....x. ........
output:
yes
result:
ok single line: 'yes'
Test #16:
score: 0
Accepted
time: 88ms
memory: 38276kb
input:
10 10 10 xxxxxxxxxx xxxxxxx.x. xxxxxxx.xx xxxxx.xxx. xxxxxxxxx. xx..xx..x. xxx.xx..xx xx.xxx.xxx xxxx.xxxxx xx..xxxxxx ..xx...... .......... ........x. .x..x...x. .x.x...... ....x...x. ..x....... .......... .......... ....x..... .......x.. .......... x..xx..... x......... ........x. .......... ........
output:
yes
result:
ok single line: 'yes'
Test #17:
score: 0
Accepted
time: 86ms
memory: 38248kb
input:
10 10 10 xxx.xxxxxx xx..xxxxx. .xxxxxxxxx xxxxxxxxxx xxxxxx.xxx .xxxxx..xx xxxxxxxxxx ..xxxxxxxx xxxx..xxx. ...xxxxxxx ......x.xx x....x.... .......... .....x.... .......... .........x ......x... ........x. ........x. ...xx.x... x......... .......... ......x... ..x....... .....x.... .........x x..x....
output:
yes
result:
ok single line: 'yes'
Test #18:
score: 0
Accepted
time: 98ms
memory: 38128kb
input:
10 10 10 x....x.xxx xxxxx..xxx xxxx..x.xx xxxxxx..x. xxxx..xxxx xxxxx.xxxx .xxxx.xxxx xx.xxxxxxx .xxxxx.xxx xxxxx.xx.x .......... x..x...... x......... .......... .......... .........x .......... ....x..x.. ........x. ...x...... .......... .......... ..x....... ...x...... ........x. ..x.....xx ........
output:
no
result:
ok single line: 'no'
Test #19:
score: 0
Accepted
time: 92ms
memory: 38248kb
input:
10 10 10 xxxxxxxx.x xx..xxxxx. .xxxx.xxxx .xxxxxxxxx x.xx.xxxx. xx.x.xxxxx .xxxxxxx.x xxxxxxxxxx xxxxxx.xxx .xx.xxx.xx x...xx.... x......... ..x....... ...x....xx .......... .......... .......... .x.......x .x........ ..x....... .......x.. .x........ ....x..x.. .......x.. .......... x......... ........
output:
yes
result:
ok single line: 'yes'
Test #20:
score: 0
Accepted
time: 85ms
memory: 38056kb
input:
10 10 10 xx.xxxxxxx xxxxxx.xxx .xxxxxxx.. xx.x.xxxx. .x.x.x.xxx x.xx.xxxxx xx.xx.xxxx .xxxxx...x xxxxxxx..x xx.x.x.xx. ......x... ........x. .......... .......... .......xx. .......... .......x.x ..x....... .......... ...x...... .........x .x..x....x ...x...... .x...x..x. .x...x...x .......... .x......
output:
no
result:
ok single line: 'no'
Test #21:
score: 0
Accepted
time: 77ms
memory: 38472kb
input:
10 10 10 xxxxxx.x.. xxxxxxxxxx xxxx..x.xx xxxxxxxxx. xxxxx.xxxx xxxxxxxxxx x.xxxxxxxx xxxxxxxxxx xx..xxxxxx xxxxxxxxxx .....x.... xx........ .x....x... .......... ....x..x.. ..x....x.x .......x.x ..xx..x... .....x.... ......xxx. x.x....... xxx....x.. .x......x. ..x....... xx..x..... .x........ ........
output:
yes
result:
ok single line: 'yes'
Test #22:
score: 0
Accepted
time: 86ms
memory: 38272kb
input:
10 10 10 xx.xx.x.xx xx.xxxxxx. xx..xx.x.x .xxxx.xx.. .xx.xxx..x .x..xxxxxx xx.x.xxxxx .x.xxxxxxx xxxxx.x..x xxxxx.xx.x ........x. .......... .........x ...x...x.. .......... .......... .......... .......... x.x......x x...x..... ........xx ......xx.. .......x.. ...x...... .......... ....x...x. ........
output:
no
result:
ok single line: 'no'
Test #23:
score: 0
Accepted
time: 117ms
memory: 38304kb
input:
10 10 10 .xx.x.xxxx xxxx.xx.xx xxxxxxxxx. xxxxxx.xxx x.xxxxxxxx x.xxx.xxxx xxxxx.x.x. xxxxxxxxxx x.xxxxx.xx xx.xxxxxxx .......x.. x........x .x........ .x..xx.... ......x... .......x.x ...x...... ......x... ........x. .........x ....x..... x......... ........x. ........x. x..x..xx.x ....x..x.. ...x....
output:
yes
result:
ok single line: 'yes'
Test #24:
score: 0
Accepted
time: 97ms
memory: 38228kb
input:
10 10 10 xx.x..xxxx x.xxxxxx.. .xx.x.xxxx xxx.xxxxxx x.x.x.xx.. xxxxxx.xx. xxxx...x.x xx.xxxxxx. .x.xxxxxxx xxxxxxxx.x .......... .....x.... ......x... .......x.. ....x..... .......... .......... x.....x.x. .......... ..x..x.... .x........ ..x..x.... ......x.x. ......xx.. .......... x......... ..xx....
output:
no
result:
ok single line: 'no'
Test #25:
score: 0
Accepted
time: 101ms
memory: 38868kb
input:
10 10 10 .x.xxxxxxx xxx.xxxx.x xxxx.x.x.x xxxxxxx..x xxxxxxxx.x .xxxxxxx.x xxx..xxxxx xxxx.xxxxx xxxxxxxxxx xxxx..xxxx ...x.x.... .x........ .....x.... .......... x..x...... ......x... .......... .......... .x........ .......... .......... .......... .......... .......... x......... .......... ........
output:
yes
result:
ok single line: 'yes'
Test #26:
score: 0
Accepted
time: 97ms
memory: 38376kb
input:
10 10 10 ..xxxxxx.x xxxx..xxx. xx.xxxx.xx xxxxxxx.xx xxxxx..xxx x.xxxx.xxx xx.xxxx.xx .xxx.xx.x. xx.xxxxxx. xxx.xxx.xx ..x....... .......... .x.x....x. ......x..x .......... ..x......x .x.......x .x...x.... ........x. ......x... .......... x......... .......... ..x....... ...x...x.. ..x....... ...x....
output:
no
result:
ok single line: 'no'
Test #27:
score: 0
Accepted
time: 100ms
memory: 38756kb
input:
10 10 10 xxx..xx.xx .xx.xxx.x. .xxx..xx.. xx.xxxx.x. xx.xxx.xxx x.xx.xxx.x xxx.x.xx.x x.xxx..xxx xx.xxxxxx. .xxx.xxxxx ..x.....xx .....x.... .......... .....x.... x......... ...x...... .......x.. ..x....... xx....xxx. .......x.. .x....x... .......... ......x... .......... .......... x.....x..x ........
output:
yes
result:
ok single line: 'yes'
Test #28:
score: 0
Accepted
time: 79ms
memory: 38236kb
input:
10 10 10 .x.xxx..xx .xx.xxx.x. xxxxx.xxxx x.xxx.xxx. x.xxxx.xxx xxxxxxxxxx ..xx.x.x.. xxxx..xxx. xxx.xx.xxx xxxxxx.xxx .......... ....x..... .......... ..x.....x. x......... x...xx.... .......... x.....x... .....x.... .......... .x.x.x..xx .xx.x.x.x. x.xxx..xx. x.xx..xxx. x.xxxx.xxx xxxxxx..xx ..xx....
output:
no
result:
ok single line: 'no'
Test #29:
score: 0
Accepted
time: 91ms
memory: 37056kb
input:
10 10 10 xxxxxxxxxx xxxxxx.xxx ..xx..xxxx x.xx.xxxxx xxxxxxxxxx xxxx..x... xx.x.xxx.x xxxxxxx.xx x.xx.xxxxx x.xxxxxxxx .xx....... .....x..x. ......x.xx .......... .xxx...... x......... x..x...... .......... .......... .......... ...x...x.. ..xx...... ...x.....x .......xx. .x......x. x......... ........
output:
yes
result:
ok single line: 'yes'
Test #30:
score: 0
Accepted
time: 90ms
memory: 38312kb
input:
10 10 10 xxxxxx.xx. xx.xxxxxxx xxxxxxxxxx xxxxxxx.xx xxxx.xx.xx x.xxxxx.x. .xxxxxxxxx xxxx.xx.xx xxxxx.xx.x x..x.xx.xx .x........ .......... .......... .x........ .......... x......... ..x.....x. ...x...... x......... ...x.x.... .......... ......x... .......... ......x... .......... .......... ........
output:
yes
result:
ok single line: 'yes'
Test #31:
score: 0
Accepted
time: 75ms
memory: 38060kb
input:
10 10 10 .xxxxxxxxx xx.xxxxxxx xxxxx.xxxx xxx.xx..xx xxxxxxxxxx xxxxxxxxx. .xxxxxxxxx xxxx.xx.xx xxxx.xxxxx xxxxxxxxx. .........x .....x.... .......... ........x. .......x.. ...x...x.. ..x....x.. .....x.... .......... .......... ........x. .x......x. ....x...x. ....x..... ..x....... .......... ..x.....
output:
yes
result:
ok single line: 'yes'