Submission #00275


ソースコード

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
99
100
101
102
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
import java.util.stream.IntStream;
public class Main{
public static void main(String[]$) throws IOException{
new Main().solve();
}
static Scanner s=new Scanner(System.in);
static IntStream REPS(int v){return IntStream.range(0,v);}
static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
static int gInt() throws IOException{return s.nextInt();}
static long gLong() throws IOException{return s.nextLong();}
static long gDouble() throws IOException{return s.nextLong();}
private void solve() throws IOException{
int h=gInt(),w=gInt();
long sum=REPS(h).mapToLong(i->s.next().chars().filter(o->o=='#').count()).sum();
int v=(int)Math.min(Math.min(h,w),Math.sqrt(sum));
System.out.println(v*v);
}
static void yesno(boolean f) {
yesno(f,"YES","NO");
}
static void yesno(boolean f,String yes,String no) {
System.out.println(f?yes:no);
}
}
class FastScanner{
private final BufferedInputStream in;
private static final int bufSize =1<<16;
private final byte buf[] =new byte[bufSize];
private int i =bufSize;
private int k =bufSize;
private final StringBuilder str =new StringBuilder();
FastScanner(InputStream in){
this.in=new BufferedInputStream(in,bufSize);
}
int nextInt() throws IOException{
return (int)nextLong();
}
long nextLong() throws IOException{
int c;
long x=0;
boolean sign=true;
while((c=nextChar())<=32)
;
if(c=='-'){
sign=false;
c=nextChar();
}
if(c=='+'){
c=nextChar();
}
while(c>='0'){
x=x*10+(c-'0');
c=nextChar();
}
return sign?x:-x;
}
int nextChar() throws IOException{
if(i==k){
k=in.read(buf,0,bufSize);
i=0;
}
return i>=k?-1:buf[i++];
}
String next() throws IOException{
int c;
str.setLength(0);
while((c=nextChar())<=32&&c!=-1)
;
if(c==-1){
return null;
}
while(c>32){
str.append((char)c);
c=nextChar();
}
return str.toString();
}
String nextLine() throws IOException{
int c;
str.setLength(0);
while((c=nextChar())<=32&&c!=-1)
;
if(c==-1){
return null;
}
while(c!='\n'){
str.append((char)c);
c=nextChar();
}
return str.toString();
}
}

ステータス

項目 データ
問題 0016 - Alice's Magic
ユーザー名 fal_rnd
投稿日時 2017-11-06 18:29:29
言語 Java
状態 Wrong Answer
得点 12.8
ソースコード長 2374 Byte
最大実行時間 820 ms
最大メモリ使用量 46148 KB

セット

セット 得点 Cases
1 Set 0 / 3.2 Input*
2 Special 4.8 / 4.8 Special
3 Bonus 8 / 8 die

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
Input01 AC 283 ms 16172 KB
1
Input02 AC 108 ms 16232 KB
1
Input03 WA 113 ms 16272 KB
1
Input04 AC 105 ms 16260 KB
1
Input05 AC 113 ms 16176 KB
1
Input06 AC 137 ms 18280 KB
1
Input07 AC 120 ms 16424 KB
1
Input08 AC 130 ms 18988 KB
1
Input09 AC 104 ms 16748 KB
1
Input10 AC 173 ms 21324 KB
1
Special AC 820 ms 46148 KB
2
die AC 274 ms 36960 KB
3