Code Submission Evaluation System Login

Datatähti 2019 alku

Start:2018-10-01 00:00:00
End:2018-10-15 00:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2019 alku - Results
History
2018-10-13 20:05:530
2018-10-13 18:48:580
2018-10-13 15:07:540
2018-10-13 15:06:120
2018-10-13 14:40:330
2018-10-13 02:04:360
2018-10-10 22:52:460
2018-10-10 22:16:040
2018-10-06 15:51:2931
2018-10-03 14:20:4531
2018-10-03 14:13:0531
2018-10-01 21:48:4331
2018-10-01 19:33:090
Task:Ruudukko
Sender:Nanohenry
Submission time:2018-10-06 15:51:29
Language:C++
Status:READY
Score:31

Feedback

groupverdictscore
#1ACCEPTED31
#2TIME LIMIT EXCEEDED0
#3TIME LIMIT EXCEEDED0

Test results

testverdicttime (s)group
#1ACCEPTED0.01 / 1.001details
#2ACCEPTED0.01 / 1.001details
#3ACCEPTED0.02 / 1.001details
#4ACCEPTED0.02 / 1.001details
#5ACCEPTED0.01 / 1.001details
#6ACCEPTED0.03 / 1.001details
#7ACCEPTED0.01 / 1.001details
#8ACCEPTED0.02 / 1.001details
#9ACCEPTED0.03 / 1.001details
#10ACCEPTED0.02 / 1.001details
#11TIME LIMIT EXCEEDED-- / 1.002details
#12TIME LIMIT EXCEEDED-- / 1.002details
#13TIME LIMIT EXCEEDED-- / 1.002details
#14TIME LIMIT EXCEEDED-- / 1.002details
#15TIME LIMIT EXCEEDED-- / 1.002details
#16TIME LIMIT EXCEEDED-- / 1.002details
#17TIME LIMIT EXCEEDED-- / 1.002details
#18TIME LIMIT EXCEEDED-- / 1.002details
#19TIME LIMIT EXCEEDED-- / 1.002details
#20TIME LIMIT EXCEEDED-- / 1.002details
#21TIME LIMIT EXCEEDED-- / 1.003details
#22TIME LIMIT EXCEEDED-- / 1.003details
#23TIME LIMIT EXCEEDED-- / 1.003details
#24TIME LIMIT EXCEEDED-- / 1.003details
#25ACCEPTED0.03 / 1.003details
#26TIME LIMIT EXCEEDED-- / 1.003details
#27TIME LIMIT EXCEEDED-- / 1.003details
#28TIME LIMIT EXCEEDED-- / 1.003details
#29ACCEPTED0.20 / 1.003details
#30ACCEPTED0.02 / 1.003details

Code

#include <iostream>
#include <string>

#define MOD 1000000007

using namespace std;

long n, r;
string t[500];
bool ac[500], bc[500], ar[500], br[500];
long v;

void search(int y) {
    if (ar[y] && br[y]) {
        search(y + 1);
    }
    if (y >= n) {
        if (v == n * 2) {
            r = (r + 1) % MOD;
        }
        return;
    }
    if (!ar[y] && !br[y]) {
        for (long i = 0; i < n; i++) {
            for (long j = 0; j < n; j++) {
                if (i == j) {
                    continue;
                }
                if (!ac[i] && !bc[j] && t[y][i] == '.' && t[y][j] == '.') {
                    ac[i] = 1;
                    bc[j] = 1;
                    t[y][i] = 'A';
                    t[y][j] = 'B';
                    v += 2;
                    search(y + 1);
                    ac[i] = 0;
                    bc[j] = 0;
                    t[y][i] = '.';
                    t[y][j] = '.';
                    v -= 2;
                }
            }
        }
    } else if (!ar[y]) {
        for (long i = 0; i < n; i++) {
            if (!ac[i] && t[y][i] == '.') {
                ac[i] = 1;
                t[y][i] = 'A';
                v++;
                search(y + 1);
                ac[i] = 0;
                t[y][i] = '.';
                v--;
            }
        }
    } else if (!br[y]) {
        for (long i = 0; i < n; i++) {
            if (!bc[i] && t[y][i] == '.') {
                bc[i] = 1;
                t[y][i] = 'B';
                v++;
                search(y + 1);
                bc[i] = 0;
                t[y][i] = '.';
                v--;
            }
        }
    }
}

int main() {
    cin >> n;
    for (long i = 0; i < n; i++) {
        cin >> t[i];
    }
    for (long i = 0; i < n; i++) {
        for (long j = 0; j < n; j++) {
            if (t[i][j] == 'A') {
                ac[j] = 1;
                ar[i] = 1;
                v++;
            }
            if (t[i][j] == 'B') {
                bc[j] = 1;
                br[i] = 1;
                v++;
            }
        }
    }
    search(0);
    cout << r % MOD << '\n';
    //system("pause");
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
2
..
..
view   save

correct output
2
view   save

user output
2
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
2
..
A.
view   save

correct output
1
view   save

user output
1
view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
2
B.
.A
view   save

correct output
0
view   save

user output
0
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
3
...
...
...
view   save

correct output
12
view   save

user output
12
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
4
....
....
....
....
view   save

correct output
216
view   save

user output
216
view   save

Test 6

Group: 1

Verdict: ACCEPTED

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

correct output
5280
view   save

user output
5280
view   save

Test 7

Group: 1

Verdict: ACCEPTED

input
5
....A
.....
.....
.....
A....
view   save

correct output
264
view   save

user output
264
view   save

Test 8

Group: 1

Verdict: ACCEPTED

input
5
B....
.....
.....
.A.B.
.B...
view   save

correct output
22
view   save

user output
22
view   save

Test 9

Group: 1

Verdict: ACCEPTED

input
5
B.A..
....A
.....
A.B..
....B
view   save

correct output
2
view   save

user output
2
view   save

Test 10

Group: 1

Verdict: ACCEPTED

input
5
A.B..
BA...
.B.A.
...BA
....B
view   save

correct output
1
view   save

user output
1
view   save

Test 11

Group: 2

Verdict: TIME LIMIT EXCEEDED

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

correct output
306442892
view   save

user output
(no output)
view   save

Test 12

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
50
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
...
view   save

correct output
694861480
view   save

user output
(no output)
view   save

Test 13

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
111
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
view   save

correct output
555319110
view   save

user output
(no output)
view   save

Test 14

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
222
.................................
.................................
.................................
.................................
.................................
view   save

correct output
108372237
view   save

user output
(no output)
view   save

Test 15

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
333
.................................
.................................
.................................
view   save

correct output
259107857
view   save

user output
(no output)
view   save

Test 16

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
444
.................................
.................................
.................................
view   save

correct output
19906314
view   save

user output
(no output)
view   save

Test 17

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
497
.................................
.................................
view   save

correct output
224313667
view   save

user output
(no output)
view   save

Test 18

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
498
.................................
.................................
view   save

correct output
929574601
view   save

user output
(no output)
view   save

Test 19

Group: 2

Verdict: TIME LIMIT EXCEEDED

input
499
.................................
.................................
view   save

correct output
600226043
view   save

user output
(no output)
view   save

Test 20

Group: 2

Verdict: TIME LIMIT EXCEEDED

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

correct output
198353194
view   save

user output
(no output)
view   save

Test 21

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
499
.................................
.........................A.......
view   save

correct output
840243733
view   save

user output
(no output)
view   save

Test 22

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
499
........................A........
..........A...B..................
view   save

correct output
4146290
view   save

user output
(no output)
view   save

Test 23

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
499
B.........A......................
....AB...........................
view   save

correct output
173518884
view   save

user output
(no output)
view   save

Test 24

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
499
...A....B........................
.........A...B...................
view   save

correct output
20044800
view   save

user output
(no output)
view   save

Test 25

Group: 3

Verdict: ACCEPTED

input
499
AB...............................
....B.......A....................
view   save

correct output
2
view   save

user output
2
view   save

Test 26

Group: 3

Verdict: TIME LIMIT EXCEEDED

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

correct output
121064146
view   save

user output
(no output)
view   save

Test 27

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
500
.................................
..................A..............
view   save

correct output
848435259
view   save

user output
(no output)
view   save

Test 28

Group: 3

Verdict: TIME LIMIT EXCEEDED

input
500
.....B........A..................
..........B...............A......
view   save

correct output
296240911
view   save

user output
(no output)
view   save

Test 29

Group: 3

Verdict: ACCEPTED

input
500
.A......B........................
..A.............B................
view   save

correct output
2196
view   save

user output
2196
view   save

Test 30

Group: 3

Verdict: ACCEPTED

input
500
...AB............................
.A.....B.........................
view   save

correct output
1
view   save

user output
1
view   save