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-09-29 17:45:52100
2015-09-29 17:41:1086
2015-09-28 19:44:2847
2015-09-28 16:04:4814
2015-09-28 16:03:2614
Task:Tontti
Sender:Kuha
Submission time:2015-09-29 17:45:52
Language:C++
Status:READY
Score:100

Feedback

groupverdictscore
#1ACCEPTED14
#2ACCEPTED33
#3ACCEPTED53

Test results

testverdicttime (s)group
#1ACCEPTED0.05 / 1.001details
#2ACCEPTED0.06 / 1.001details
#3ACCEPTED0.05 / 1.001details
#4ACCEPTED0.06 / 1.001details
#5ACCEPTED0.05 / 1.001details
#6ACCEPTED0.08 / 1.002details
#7ACCEPTED0.07 / 1.002details
#8ACCEPTED0.07 / 1.002details
#9ACCEPTED0.07 / 1.002details
#10ACCEPTED0.07 / 1.002details
#11ACCEPTED0.82 / 1.003details
#12ACCEPTED0.82 / 1.003details
#13ACCEPTED0.58 / 1.003details
#14ACCEPTED0.63 / 1.003details
#15ACCEPTED0.63 / 1.003details

Code

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#define INF 999999999
#define ll long long
using namespace std;

int main()
{
    int n, m, tr;
    cin>>n>>m>>tr;

    char c[n][m];
    int v[n][m][2];

    for (int y = 0; y < n; y++) {
        for (int x = 0; x < m; x++) {
            cin>>c[y][x];
            v[y][x][0] = 0;
            if (x > 0) v[y][x][0] = v[y][x - 1][0];
            if (c[y][x] == '*') v[y][x][0]++;
            v[y][x][1] = v[y][x][0];
            if (y > 0) v[y][x][1] += v[y - 1][x][1];
        }
    }
    int ans = 0;
    for (int y = 0; y < n; y++) {
        for (int x = 0; x < m; x++) {
            int i = 0;
            int mi = -1;
            int mx = -1;
            int mini = min(m - x, n - y); // BINRIHAKU!
            bool tf = false;
            i = 0;
            for (int t = mini / 2; t >= 0; t /= 2) {
                bool b = true;

                while (b && i + t < mini) {
                    i += t;
                    b = true;
                    int w = v[y+i][x+i][1];
                    if (x > 0 && y > 0) w += v[y-1][x-1][1];
                    if (x > 0) w -= v[y+i][x-1][1];
                    if (y > 0) w -= v[y-1][x+i][1];
                    if (w > tr) b = false;
                    else if (w == tr) {
                        b = false;
                        tf = true;
                    }
                    //if (b) cout<<w<<" "<<i<<" too big!"<<endl;
                    //else cout<<w<<" "<<i<<" secondary!"<<endl;
                    if (b) mi = i;
                    else i -= t;
                    if (t == 0) break;
                }
                if (t == 0) break;
            }
            if (!tf) continue;
            i = 0;
            for (int t = mini / 2; t >= 0; t /= 2) {
                bool b = true;

                while (b && i + t < mini) {
                    i += t;
                    b = true;
                    int w = v[y+i][x+i][1];
                    if (x > 0 && y > 0) w += v[y-1][x-1][1];
                    if (x > 0) w -= v[y+i][x-1][1];
                    if (y > 0) w -= v[y-1][x+i][1];
                    if (w > tr) b = false;
                    if (b) mx = i;
                    else i -= t;
                    if (t == 0) break;
                }
                if (t == 0) break;
            }

            //cout<<x<<" "<<y<<" "<<mi<<" "<<mx<<endl;
            if (tf) ans += mx - mi;
        }
    }

    cout<<ans<<endl;

    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: ACCEPTED

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

correct output
489611392

view   save

user output
489611392

view   save

Test 12

Group: 3

Verdict: ACCEPTED

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

correct output
120725884

view   save

user output
120725884

view   save

Test 13

Group: 3

Verdict: ACCEPTED

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

correct output
1849

view   save

user output
1849

view   save

Test 14

Group: 3

Verdict: ACCEPTED

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

correct output
2665

view   save

user output
2665

view   save

Test 15

Group: 3

Verdict: ACCEPTED

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

correct output
5587

view   save

user output
5587

view   save