CSES - Datatähti 2023 loppu - Results
Submission details
Task:Ruudukko
Sender:andreibe
Submission time:2023-01-26 13:13:34 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.00 s1, 2, 3details
#20.00 s1, 2, 3details
#30.00 s1, 2, 3details
#40.00 s1, 2, 3details
#50.00 s1, 2, 3details
#6ACCEPTED0.00 s1, 2, 3details
#7ACCEPTED0.00 s1, 2, 3details
#8ACCEPTED0.00 s1, 2, 3details
#90.00 s1, 2, 3details
#10ACCEPTED0.00 s1, 2, 3details
#11ACCEPTED0.00 s1, 2, 3details
#12ACCEPTED0.00 s1, 2, 3details
#130.00 s1, 2, 3details
#14ACCEPTED0.00 s1, 2, 3details
#15ACCEPTED0.00 s1, 2, 3details
#16ACCEPTED0.00 s1, 2, 3details
#170.01 s2, 3details
#18ACCEPTED0.01 s2, 3details
#19ACCEPTED0.01 s2, 3details
#20ACCEPTED0.01 s2, 3details
#210.01 s2, 3details
#22ACCEPTED0.01 s2, 3details
#23ACCEPTED0.01 s2, 3details
#24ACCEPTED0.01 s2, 3details
#25ACCEPTED0.07 s3details
#26ACCEPTED0.07 s3details
#27ACCEPTED0.07 s3details
#28ACCEPTED0.07 s3details
#29ACCEPTED0.07 s3details
#30ACCEPTED0.07 s3details
#31ACCEPTED0.07 s3details
#32ACCEPTED0.07 s3details
#33ACCEPTED0.07 s3details
#34ACCEPTED0.07 s3details
#35ACCEPTED0.07 s3details
#36ACCEPTED0.07 s3details

Compiler report

input/code.cpp: In function 'bool tarkistus(int, int)':
input/code.cpp:91:1: warning: control reaches end of non-void function [-Wreturn-type]
   91 | }
      | ^

Code

#include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <algorithm>
#include <vector>
#include <fstream>
#include <set>
#include <unordered_map>
#include <queue>
#include <chrono>
#include <climits>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace std::chrono;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define S second
#define F first
//#define A 999999999999999999LL
#define M 1000000007
#define N 202020
#define REDIR \
ifstream in("input.txt"); \
cin.rdbuf(in.rdbuf());
int d[1010][1010];
int z[1010][1010];
bool eiole(int y, int x, int n, int m) {
if (y < 0 || x < 0 || y >= n || x >= m) {
return true;
}
return d[y][x] ? false : true;
}
void print(int n, int m) {
for (int y = 0; y < n; y++)
{
for (int x = 0; x < m; x++)
{
cout << (d[y][x] ? "#" : ".");
}
cout << endl;
}
}
int syvyys(int y, int x, int y2, int x2, int n, int m) {
if (y < 0 || x < 0 || y >= n || x >= m || d[y][x]) {
return 0;
}
if (z[y][x]) return -99;
z[y][x] = 1;
int total = 1;
if (y+1 != y2 || x != x2) total += syvyys(y+1,x, y,x,n,m);
if (y-1 != y2 || x != x2) total += syvyys(y-1,x, y,x,n,m);
if (y != y2 || x+1 != x2) total += syvyys(y,x+1, y,x,n,m);
if (y != y2 || x-1 != x2) total += syvyys(y,x-1, y,x,n,m);
return total;
}
bool tarkistus(int n, int m) {
int total = 0;
for (int y = 0; y < n; y++)
{
for (int x = 0; x < m; x++)
{
z[y][x] = 0;
if (!d[y][x]) total++;
}
}
for (int y = 0; y < n; y++)
{
for (int x = 0; x < m; x++)
{
if (!d[y][x]) {
int maara = syvyys(y,x,-1,-1,n,m);
//cout << maara << " vs " << total << endl;
//print();
if (maara != total) return false;
return true;
}
}
}
}
void solve(int n, int m) {
for (int y = 0; y < n; y++){
for (int x = 0; x < m; x++){
d[y][x] = 0;
}
}
if (n == 1 || m == 1) {
return;
}
int x = 1; bool leftStart = true;
while (x < m) {
bool left = leftStart;
for (int y = 0; y < n-1; y++)
{
if (left) d[y][x] = 1;
else if (x+1 != m-1 || (leftStart && y%4>1) || (!leftStart && y % 4>1))d[y][x+1] = 1;
left = !left;
}
if (left) {
d[n-1][x-1] = 1;
}
x += 3;
leftStart = !leftStart;
}
if (!tarkistus(n,m)) {
d[n-1][m-1] = 1;
}
print(n,m);
//cout << tarkistus(n,m);
}
int main() {
/*
REDIR;
vector<P> v = {{999,995}, {999,996}, {999,997}, {999,998}, {999,999}, {999,1000}, {1000,995},
{1000,996},{1000,997}, {1000,998}, {1000,998}};
for (P &p : v) {
solve(p.first, p.second);
}
*/
int n,m;
cin >> n >> m;
solve(n,m);
//solve(n,m);
//cout << tarkistus(n,m) << endl;
//return 0;
/*
int eitoimi = 0;
for (int korkeus = 1000; korkeus <= 1000; korkeus++)
{
for (int leveys = 1000; leveys <= 1000; leveys++)
{
solve(korkeus, leveys);
if (!tarkistus(korkeus,leveys)) {
d[korkeus-1][leveys-1] = 1;
if (tarkistus(korkeus,leveys)) {
cout << "Toimii: " << korkeus << " * " << leveys << endl;
}
else {
eitoimi++;
cout << "Ei toimi: " << korkeus << " * " << leveys << endl;
print(korkeus,leveys);
}
} else {
cout << "Toimii: " << korkeus << " * " << leveys << endl;
}
}
}
cout << eitoimi << endl;
*/
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
1 1

correct output
.

user output
(empty)

Test 2

Group: 1, 2, 3

Verdict:

input
1 2

correct output
..

user output
(empty)

Test 3

Group: 1, 2, 3

Verdict:

input
1 3

correct output
...

user output
(empty)

Test 4

Group: 1, 2, 3

Verdict:

input
1 4

correct output
....

user output
(empty)

Test 5

Group: 1, 2, 3

Verdict:

input
2 1

correct output
.
.

user output
(empty)

Test 6

Group: 1, 2, 3

Verdict: ACCEPTED

input
2 2

correct output
.#
..

user output
.#
..

Test 7

Group: 1, 2, 3

Verdict: ACCEPTED

input
2 3

correct output
.#.
...

user output
.#.
...

Test 8

Group: 1, 2, 3

Verdict: ACCEPTED

input
2 4

correct output
.#.#
....

user output
.#..
...#

Test 9

Group: 1, 2, 3

Verdict:

input
3 1

correct output
.
.
.

user output
(empty)

Test 10

Group: 1, 2, 3

Verdict: ACCEPTED

input
3 2

correct output
.#
..
.#

user output
.#
..
#.

Test 11

Group: 1, 2, 3

Verdict: ACCEPTED

input
3 3

correct output
.#.
...
.#.

user output
.#.
...
#.#

Test 12

Group: 1, 2, 3

Verdict: ACCEPTED

input
3 4

correct output
.#.#
....
.#.#

user output
.#..
..#.
#...

Test 13

Group: 1, 2, 3

Verdict:

input
4 1

correct output
.
.
.
.

user output
(empty)

Test 14

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 2

correct output
..
.#
..
#.

user output
.#
..
.#
..

Test 15

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 3

correct output
...
.#.
..#
#..

user output
.#.
...
.#.
..#

Test 16

Group: 1, 2, 3

Verdict: ACCEPTED

input
4 4

correct output
....
.#.#
..#.
#...

user output
.#..
..#.
.#..
...#

Test 17

Group: 2, 3

Verdict:

input
999 1

correct output
.
.
.
.
.
...

user output
(empty)

Test 18

Group: 2, 3

Verdict: ACCEPTED

input
999 2

correct output
.#
..
.#
..
#.
...

user output
.#
..
.#
..
.#
...
Truncated

Test 19

Group: 2, 3

Verdict: ACCEPTED

input
999 3

correct output
.#.
...
.#.
..#
#..
...

user output
.#.
...
.#.
..#
.#.
...
Truncated

Test 20

Group: 2, 3

Verdict: ACCEPTED

input
999 4

correct output
.#.#
....
.#.#
..#.
#...
...

user output
.#..
..#.
.#..
..#.
.#..
...
Truncated

Test 21

Group: 2, 3

Verdict:

input
1000 1

correct output
.
.
.
.
.
...

user output
(empty)

Test 22

Group: 2, 3

Verdict: ACCEPTED

input
1000 2

correct output
..
.#
..
#.
..
...

user output
.#
..
.#
..
.#
...
Truncated

Test 23

Group: 2, 3

Verdict: ACCEPTED

input
1000 3

correct output
...
.#.
..#
#..
..#
...

user output
.#.
...
.#.
..#
.#.
...
Truncated

Test 24

Group: 2, 3

Verdict: ACCEPTED

input
1000 4

correct output
....
.#.#
..#.
#...
..#.
...

user output
.#..
..#.
.#..
..#.
.#..
...
Truncated

Test 25

Group: 3

Verdict: ACCEPTED

input
999 995

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 26

Group: 3

Verdict: ACCEPTED

input
999 996

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 27

Group: 3

Verdict: ACCEPTED

input
999 997

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 28

Group: 3

Verdict: ACCEPTED

input
999 998

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 29

Group: 3

Verdict: ACCEPTED

input
999 999

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 30

Group: 3

Verdict: ACCEPTED

input
999 1000

correct output
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 31

Group: 3

Verdict: ACCEPTED

input
1000 995

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 32

Group: 3

Verdict: ACCEPTED

input
1000 996

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 33

Group: 3

Verdict: ACCEPTED

input
1000 997

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 34

Group: 3

Verdict: ACCEPTED

input
1000 998

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 35

Group: 3

Verdict: ACCEPTED

input
1000 999

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated

Test 36

Group: 3

Verdict: ACCEPTED

input
1000 1000

correct output
.................................

user output
.#...#.#...#.#...#.#...#.#...#...
Truncated