Code Submission Evaluation System Login

Datatähti 2016 alku

Start:2015-09-28 00:00:00
End:2015-10-12 00:00:00
 

Tasks | Scoreboard | Statistics


CSES - Datatähti 2016 alku - Results
History
2015-10-02 17:40:2547
2015-10-02 17:37:2047
2015-10-02 17:35:270
2015-10-02 17:33:4847
2015-10-02 17:33:070
2015-10-02 17:31:400
2015-10-02 17:30:410
2015-10-02 17:29:330
2015-10-02 17:26:1547
2015-10-02 15:46:5947
2015-10-02 14:55:1347
2015-10-02 14:50:3447
2015-10-01 16:31:4247
2015-09-30 19:05:1314
2015-09-30 19:04:360
2015-09-30 19:04:100
2015-09-30 18:34:130
2015-09-30 17:59:4314
2015-09-30 17:19:2614
2015-09-30 16:22:590
2015-09-29 19:11:1414
2015-09-29 15:09:5014
2015-09-29 14:54:2914
2015-09-29 14:21:000
2015-09-29 14:15:160
2015-09-29 14:13:400
2015-09-29 13:55:3114
2015-09-29 13:54:530
2015-09-29 13:26:2714
2015-09-29 13:22:3114
2015-09-29 13:20:43
2015-09-29 13:19:570
2015-09-29 13:14:180
2015-09-29 13:12:480
2015-09-29 12:53:5614
2015-09-29 12:50:3514
2015-09-29 12:04:3614
2015-09-28 22:19:210
2015-09-28 20:45:0014
2015-09-28 20:30:4914
Task:Tontti
Sender:6502
Submission time:2015-10-02 17:40:25
Language:C++
Status:READY
Score:47

Feedback

groupverdictscore
#1ACCEPTED14
#2ACCEPTED33
#3TIME LIMIT EXCEEDED0

Test results

testverdicttime (s)group
#1ACCEPTED0.06 / 1.001details
#2ACCEPTED0.05 / 1.001details
#3ACCEPTED0.06 / 1.001details
#4ACCEPTED0.05 / 1.001details
#5ACCEPTED0.06 / 1.001details
#6ACCEPTED0.31 / 1.002details
#7ACCEPTED0.31 / 1.002details
#8ACCEPTED0.19 / 1.002details
#9ACCEPTED0.21 / 1.002details
#10ACCEPTED0.23 / 1.002details
#11TIME LIMIT EXCEEDED-- / 1.003details
#12TIME LIMIT EXCEEDED-- / 1.003details
#13TIME LIMIT EXCEEDED-- / 1.003details
#14TIME LIMIT EXCEEDED-- / 1.003details
#15TIME LIMIT EXCEEDED-- / 1.003details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:48:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (s = c; s <= mx-1; s++) {
                ^
input/code.cpp:56:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (o = 1; o <= s; o++)
                   ^
input/code.cpp:62:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for (o = 0; o < s; o++, q++, w++)
                    ^
input/code.cpp:71:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (o = 0; o < s; o++, p+=mf) {
                     ^
input/code.cpp:79:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
        for (w = 0; w < s; w++) {
                      ^
input/code.cpp:96:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = n - 1; i >= z; i--) {
                      ^
input/code.cpp:106:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (o = 1; o < s; o++, p+=mf) {
                   ^
input/code.cpp:116:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (; j >= z; j--) {
              ^

Code

#include <iostream>
#include <iterator>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
	cin.sync_with_stdio(false);
	int i, j, n, m, k, x, q, w, o, p, nn, mm, mf;
	unsigned sz, s;
	cin >> n >> m >> k;
	char input[n][m];
	nn = 1;
	mm = 1;
	int v;
	v = n;
	while (v >>= 1) 
	{
		nn++;
	}
	v = m;
	while (v >>= 1) 
	{
		mm++;
	}
	mf = 1 << mm;
	int kq = mf*(1<<nn);
	char a[kq];
	int f[kq];
	short ag[kq];
	short ah[n];	
	for (i = 0; i < n; i++)
		cin >> input[i];
	sz = (int)ceil(sqrt((double)k));
	x = 0;
	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++) {
			a[(i<<mm)+j] = !(input[i][j]=='.');
			f[(i<<mm)+j] = 0;
			if(k<2)
				x += a[(i<<mm)+j]^k^1;
		}
	int mx = min(m,n);
	unsigned c = max(sz,2u);
	int g = 0, h = 0, d, first = 1, scale = 1;
	unsigned z;
	for (s = c; s <= mx-1; s++) {
		//printf("%d ",s);
		z = s - 1;
		first = 1;
		if (s == c) {
			for (i = z; i < n; i++) {
				w = 0;
				q = (i<<mm)+m-1;
				for (o = 1; o <= s; o++)
					w += a[q-o];
				ah[i] = w;
				if (i > 0) {
					q = i << mm;
					w = q - (s << mm);
					for (o = 0; o < s; o++, q++, w++)
						h += (a[q] - a[w]);
					g = h;
				}
				scale = 0;
				for (j = z; j < m; j++) {
					d = (i<<mm)+j;
					if (scale) {
						p = ((i-z)<<mm)+j;
						for (o = 0; o < s; o++, p+=mf) {
							g += (a[p] - a[p-s]);
						}
					} else if (first) {
						first = 0;
						g = f[d];
						o = s<<mm;
						for (q = 0; q < o; q+=mf) {
							for (w = 0; w < s; w++) {
								g += a[q+w];
							}
						}
						h = g;
						scale = 1;
					} else
						scale = 1;
					f[d] = g;
					//printf("s:%d\ti:%d\tj:%d\tn:%d\tm:%d\tf:%d\n",s,i,j,n,m,f[d]);
					x += (g == k);
				}
			}
		} else {
			int v = (n - 1) << mm;
			g = 0;
			h = 0;
			for (i = n - 1; i >= z; i--) {
				j = m - 1;
				int d = v+j;
				w = f[d-mf-1] + a[d];
				g = 0;
				h = ah[i];
				p = mf;
				if (s > c + 1) {
					h += a[d-z];
				}
				for (o = 1; o < s; o++, p+=mf) {
					g += a[d-p];
				}
				ag[d] = g;
				ah[i] = h;
				w += g + h;
				x += (w == k);
				f[d] = w;
				d--;
				j--;
				for (; j >= z; j--) {
					char ad = a[d];
					p = d - mf;
					w = f[p-1] + ad;
					q = d - (z << mm);
					if (i == n - 1) {
						g = 0;
						for (o = p; o >= q; o -= mf) {
							g += a[o];
						}
					} else {
						g = ag[d+mf] + a[q] - ad;
					}
					h += a[d-z] - ad;
					w += g + h;
					x += (w == k);
					ag[d] = g;
					f[d] = w;
					d--;
				}
				v -= mf;
			}
			/*for (i = n - 1; i >= z; i--) {
				q = (i*m);
				for (j = m - 1; j >= z; j--)
					ag[q+j] = ah[q+j];
			}*/
		}
		/*for (i = 0; i < n; i++) {
			for (j = 0; j < m; j++) {
				printf("%d",f[i*m+j]);
			}
			printf("\n");
		}
		printf("\n");*/
	}
	cout << x << "\n";
	return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
10 10 1
......*...
.......*..
*..*....*.
*....*....
..........
..........
..*.......
....*.....
..........
.........*
view   save

correct output
94
view   save

user output
94
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
10 10 5
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
view   save

correct output
0
view   save

user output
0
view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
10 10 10
**...*...*
*..*.**.*.
...**.*..*
*...**.*..
***.*.*.*.
.*.*.*.**.
*..*.*....
.*.***...*
**.*......
..*...**.*
view   save

correct output
4
view   save

user output
4
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
10 10 5
****......
*.*.**..**
....*.*..*
...*.***..
.*..*.**..
.***.*....
*...*.*...
*.*....*.*
.*.***..*.
.*..*..**.
view   save

correct output
16
view   save

user output
16
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
10 10 2
**.***..*.
...*.*....
.***.*...*
***.***..*
..*.******
...*.....*
*.***.*.**
..***.**.*
*.*.******
*..*.*..**
view   save

correct output
30
view   save

user output
30
view   save

Test 6

Group: 2

Verdict: ACCEPTED

input
500 500 1
.................................
.................................
view   save

correct output
9552040
view   save

user output
9552040
view   save

Test 7

Group: 2

Verdict: ACCEPTED

input
500 500 5
.................................
.................................
view   save

correct output
1536063
view   save

user output
1536063
view   save

Test 8

Group: 2

Verdict: ACCEPTED

input
500 500 25000
**...*...**..*.*..*.**.*..*.*....
.**.*.**.**....*.*.***...........
view   save

correct output
288
view   save

user output
288
view   save

Test 9

Group: 2

Verdict: ACCEPTED

input
500 500 12500
**.**.*..*...*.**...*.***........
************.*....**..*.*.*.**...
view   save

correct output
786
view   save

user output
786
view   save

Test 10

Group: 2

Verdict: ACCEPTED

input
500 500 5000
.*.*.**..*.*.**.**..*..**...*....
**..*...*..**..***.*..*****......
view   save

correct output
1763
view   save

user output
1763
view   save

Test 11

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
2000 2000 1
.................................
view   save

correct output
489611392
view   save

user output
(no output)
view   save

Test 12

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
2000 2000 5
.................................
view   save

correct output
120725884
view   save

user output
(no output)
view   save

Test 13

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
2000 2000 400000
..*..**.**.**.*.***...**.*..**...
view   save

correct output
1849
view   save

user output
(no output)
view   save

Test 14

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
2000 2000 200000
***.*....*.*..*....**..*..*.*....
view   save

correct output
2665
view   save

user output
(no output)
view   save

Test 15

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
2000 2000 80000
**.**...*.***.**....**.*....*....
view   save

correct output
5587
view   save

user output
(no output)
view   save