CSES - HIIT Open 2019 - Results
Submission details
Task:L-Trominos
Sender:Barely div 1
Submission time:2019-05-25 15:58:44 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.01 sdetails
#20.02 sdetails
#30.02 sdetails
#40.02 sdetails
#50.03 sdetails
#6ACCEPTED0.02 sdetails
#70.01 sdetails
#80.01 sdetails
#90.03 sdetails
#10ACCEPTED0.02 sdetails
#110.02 sdetails
#120.02 sdetails
#13ACCEPTED0.02 sdetails
#14ACCEPTED0.02 sdetails
#150.02 sdetails
#16ACCEPTED0.01 sdetails
#170.01 sdetails
#18ACCEPTED0.02 sdetails
#190.02 sdetails
#20ACCEPTED0.02 sdetails
#210.02 sdetails
#22ACCEPTED0.04 sdetails
#230.02 sdetails
#24ACCEPTED0.01 sdetails
#250.02 sdetails
#260.02 sdetails
#27ACCEPTED0.02 sdetails
#280.03 sdetails
#290.01 sdetails
#30ACCEPTED0.02 sdetails
#31ACCEPTED0.01 sdetails
#320.03 sdetails
#330.02 sdetails
#340.02 sdetails
#350.01 sdetails
#360.03 sdetails
#37ACCEPTED0.02 sdetails
#380.01 sdetails
#390.02 sdetails
#40ACCEPTED0.02 sdetails
#41ACCEPTED0.03 sdetails
#42ACCEPTED0.02 sdetails
#430.02 sdetails
#44ACCEPTED0.03 sdetails
#450.01 sdetails
#46ACCEPTED0.02 sdetails
#47ACCEPTED0.03 sdetails
#48ACCEPTED0.01 sdetails
#490.02 sdetails
#50ACCEPTED0.03 sdetails
#510.02 sdetails
#52ACCEPTED0.02 sdetails
#53ACCEPTED0.02 sdetails
#54ACCEPTED0.02 sdetails
#550.02 sdetails
#56ACCEPTED0.02 sdetails
#570.03 sdetails
#58ACCEPTED0.02 sdetails
#590.02 sdetails
#60ACCEPTED0.01 sdetails
#610.03 sdetails
#62ACCEPTED0.01 sdetails
#630.03 sdetails
#64ACCEPTED0.03 sdetails
#65ACCEPTED0.02 sdetails
#66ACCEPTED0.02 sdetails
#67ACCEPTED0.02 sdetails
#68ACCEPTED0.03 sdetails
#69ACCEPTED0.03 sdetails
#70ACCEPTED0.03 sdetails
#71ACCEPTED0.02 sdetails
#720.02 sdetails
#73ACCEPTED0.03 sdetails
#74ACCEPTED0.02 sdetails
#750.02 sdetails
#760.01 sdetails
#770.02 sdetails
#780.02 sdetails
#79ACCEPTED0.02 sdetails
#800.01 sdetails
#81ACCEPTED0.02 sdetails
#82ACCEPTED0.03 sdetails
#83ACCEPTED0.03 sdetails
#84ACCEPTED0.02 sdetails
#85ACCEPTED0.02 sdetails
#86ACCEPTED0.02 sdetails
#87ACCEPTED0.02 sdetails
#880.01 sdetails
#89ACCEPTED0.02 sdetails
#90ACCEPTED0.03 sdetails
#910.02 sdetails

Code

#include <iostream>
#include <vector>
#include <deque>

using namespace std;
typedef long long LL;

#define foxnews cin
#define twitter cout

vector<vector<int>> g;

void p32(int r, int c, char b) {
  g[r+0][c+0] = b;
  g[r+0][c+1] = b;
  g[r+1][c+0] = b;
  g[r+1][c+1] = b+1;
  g[r+2][c+0] = b+1;
  g[r+2][c+1] = b+1;
}

void p23(int r, int c, char b) {
  g[r+0][c+0] = b;
  g[r+1][c+0] = b;
  g[r+0][c+1] = b;
  g[r+1][c+1] = b+1;
  g[r+0][c+2] = b+1;
  g[r+1][c+2] = b+1;
}

int main(){
    int n, m;
    foxnews >> n >> m;
    
    bool transpose = false;
    if(m % 6 == 0) {
	swap(n,m);
        transpose = true;
        if(m < 2) {
          cout << "IMPOSSIBLE" << endl;
          return 0;
        }
    } else {
        if(m % 3 == 0 && (n%2 == 0)) {
          //cout << "SWAP!" << endl;
          swap(n, m);
          transpose = true;
        }
	//cout << n << " x " << m << endl;
        if(m & 1) {
          cout << m << "IMPOSSIBLE" << endl;
          return 0;
        }
    }

    g.resize(n);
    for(int j=0; j<n; j++) g[j].resize(m);
 
    for(int c=0; c<m; c++) {
      for(int r=0; r<n; r++)
        g[r][c] = 'A'+r+c;
    }

    //for(int r=0; r<n; r++) {
    //  for(int c=0; c<m; c++)
    //    cout << (char)g[r][c];
    //  cout << endl;
    //}
    
    //cout << n << " x " << m << endl;
    if(n % 6 == 0) {
      for(int r=0; r<n; r+=3) {
        //cout << "Row " << r << endl;
        for(int c=0; c+1<m; c+=2) {
          p32(r,c, (c/2 & 1) ? 'E' : 'G');
        }
      }
      if(m & 1) {
        for(int r=0; r<n; r+=2) {
          p23(r,m-3, (r/2 & 1) ? 'A' : 'C');
        }
      } 
    } else { // n jaollinen 3:lla, m 2:lla
      for(int r=0; r<n; r+=3) {
        for(int c=0; c<m; c+=2) {
          p32(r,c, (c/2 & 1) ? 'E' : 'G');
        }
      }
    }

    if(!transpose) {
    for(int r=0; r<n; r++) {
      for(int c=0; c<m; c++)
        cout << (char)g[r][c];
      cout << endl;
    }
} else {
    for(int c=0; c<m; c++) {
      for(int r=0; r<n; r++)
        cout << (char)g[r][c];
      cout << endl;
    }
}

}

Test details

Test 1

Verdict:

input
1 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 2

Verdict:

input
1 2

correct output
IMPOSSIBLE

user output
(empty)

Test 3

Verdict:

input
1 3

correct output
IMPOSSIBLE

user output
3IMPOSSIBLE

Test 4

Verdict:

input
1 4

correct output
IMPOSSIBLE

user output
(empty)

Test 5

Verdict:

input
1 5

correct output
IMPOSSIBLE

user output
5IMPOSSIBLE

Test 6

Verdict: ACCEPTED

input
1 6

correct output
IMPOSSIBLE

user output
IMPOSSIBLE

Test 7

Verdict:

input
1 9

correct output
IMPOSSIBLE

user output
9IMPOSSIBLE

Test 8

Verdict:

input
2 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 9

Verdict:

input
2 2

correct output
IMPOSSIBLE

user output
(empty)

Test 10

Verdict: ACCEPTED

input
2 3

correct output
GHH
GGH

user output
GGH
GHH

Test 11

Verdict:

input
2 4

correct output
IMPOSSIBLE

user output
(empty)

Test 12

Verdict:

input
2 5

correct output
IMPOSSIBLE

user output
5IMPOSSIBLE

Test 13

Verdict: ACCEPTED

input
2 6

correct output
GHHJFF
GGHJJF

user output
GGHGGH
GHHGHH

Test 14

Verdict: ACCEPTED

input
2 9

correct output
GHHJFFHII
GGHJJFHHI

user output
GGHGGHGGH
GHHGHHGHH

Test 15

Verdict:

input
3 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 16

Verdict: ACCEPTED

input
3 2

correct output
GG
HG
HH

user output
GG
GH
HH

Test 17

Verdict:

input
3 3

correct output
IMPOSSIBLE

user output
3IMPOSSIBLE

Test 18

Verdict: ACCEPTED

input
3 4

correct output
GGII
GLIN
LLNN

user output
GGEE
GHEF
HHFF

Test 19

Verdict:

input
3 5

correct output
IMPOSSIBLE

user output
5IMPOSSIBLE

Test 20

Verdict: ACCEPTED

input
3 6

correct output
GGIIFF
GLINFK
LLNNKK

user output
CCAACC
CDABCD
DDBBDD

Test 21

Verdict:

input
3 7

correct output
IMPOSSIBLE

user output
7IMPOSSIBLE

Test 22

Verdict: ACCEPTED

input
3 8

correct output
GGIIFFHH
GLINFKHM
LLNNKKMM

user output
GGEEGGEE
GHEFGHEF
HHFFHHFF

Test 23

Verdict:

input
3 9

correct output
IMPOSSIBLE

user output
9IMPOSSIBLE

Test 24

Verdict: ACCEPTED

input
3 10

correct output
GGIIFFHHJJ
GLINFKHMJO
LLNNKKMMOO

user output
GGEEGGEEGG
GHEFGHEFGH
HHFFHHFFHH

Test 25

Verdict:

input
4 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 26

Verdict:

input
4 2

correct output
IMPOSSIBLE

user output
(empty)

Test 27

Verdict: ACCEPTED

input
4 3

correct output
GGL
GLL
IIN
INN

user output
GGH
GHH
EEF
EFF

Test 28

Verdict:

input
4 4

correct output
IMPOSSIBLE

user output
(empty)

Test 29

Verdict:

input
4 5

correct output
IMPOSSIBLE

user output
5IMPOSSIBLE

Test 30

Verdict: ACCEPTED

input
4 6

correct output
GHHJFF
GGHJJF
QRRTPP
QQRTTP

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF

Test 31

Verdict: ACCEPTED

input
4 9

correct output
GHHJFFHII
GGHJJFHHI
QRRTPPRSS
QQRTTPRRS

user output
GGHGGHGGH
GHHGHHGHH
EEFEEFEEF
EFFEFFEFF

Test 32

Verdict:

input
5 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 33

Verdict:

input
5 2

correct output
IMPOSSIBLE

user output
(empty)

Test 34

Verdict:

input
5 3

correct output
IMPOSSIBLE

user output
3IMPOSSIBLE

Test 35

Verdict:

input
5 4

correct output
IMPOSSIBLE

user output
(empty)

Test 36

Verdict:

input
5 5

correct output
IMPOSSIBLE

user output
5IMPOSSIBLE

Test 37

Verdict: ACCEPTED

input
5 6

correct output
GGIIFF
GMMIFK
QQMTKK
QVXTTU
VVXXUU

user output
GGHGGH
GHHGHH
CCAACC
CDABCD
DDBBDD

Test 38

Verdict:

input
5 9

correct output
GGIIFGGII
GMMIFFGIN
QQMTTQQNN
QVXTUQWXX
VVXXUUWWX

user output
9IMPOSSIBLE

Test 39

Verdict:

input
6 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 40

Verdict: ACCEPTED

input
6 2

correct output
GG
HG
HH
JJ
FJ
...

user output
GG
GH
HH
GG
GH
...

Test 41

Verdict: ACCEPTED

input
6 3

correct output
GGL
GLL
IIN
INN
FFK
...

user output
GGH
GHH
EEF
EFF
GGH
...

Test 42

Verdict: ACCEPTED

input
6 4

correct output
GGQQ
HGRQ
HHRR
JJTT
FJPT
...

user output
GGEE
GHEF
HHFF
GGEE
GHEF
...

Test 43

Verdict:

input
6 5

correct output
GGQQV
GMQVV
IMMXX
IITTX
FFKTU
...

user output
5IMPOSSIBLE

Test 44

Verdict: ACCEPTED

input
6 6

correct output
GGIIFF
GLINFK
LLNNKK
VVXXUU
VBXDUA
...

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF
GGHGGH
...

Test 45

Verdict:

input
6 7

correct output
GHHJJGG
GGHJOGL
QRROOLL
QQRYYVV
BCCYEVB
...

user output
7IMPOSSIBLE

Test 46

Verdict: ACCEPTED

input
6 8

correct output
GGIIFFHH
GLINFKHM
LLNNKKMM
VVXXUUWW
VBXDUAWC
...

user output
GGEEGGEE
GHEFGHEF
HHFFHHFF
GGEEGGEE
GHEFGHEF
...

Test 47

Verdict: ACCEPTED

input
6 9

correct output
GHHJJGGII
GGHJOGLIN
QRROOLLNN
QQRYYVVXX
BCCYEVBXD
...

user output
GGHGGHGGH
GHHGHHGHH
EEFEEFEEF
EFFEFFEFF
GGHGGHGGH
...

Test 48

Verdict: ACCEPTED

input
6 10

correct output
GGIIFFHHJJ
GLINFKHMJO
LLNNKKMMOO
VVXXUUWWYY
VBXDUAWCYE
...

user output
GGEEGGEEGG
GHEFGHEFGH
HHFFHHFFHH
GGEEGGEEGG
GHEFGHEFGH
...

Test 49

Verdict:

input
7 3

correct output
IMPOSSIBLE

user output
3IMPOSSIBLE

Test 50

Verdict: ACCEPTED

input
7 6

correct output
GGQQBB
HGRQCB
HHRRCC
JJOYYE
JOOYEE
...

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF
CCAACC
...

Test 51

Verdict:

input
7 9

correct output
GGIIFGGII
GMMIFFGIN
QQMTTQQNN
QVXTUQWXX
VVXXUUWWX
...

user output
9IMPOSSIBLE

Test 52

Verdict: ACCEPTED

input
8 3

correct output
GGL
GLL
IIN
INN
FFK
...

user output
GGH
GHH
EEF
EFF
GGH
...

Test 53

Verdict: ACCEPTED

input
8 6

correct output
GGLVVB
GLLVBB
IINXXD
INNXDD
FFKUUA
...

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF
GGHGGH
...

Test 54

Verdict: ACCEPTED

input
8 9

correct output
GHHJFFHII
GGHJJFHHI
QRRTPPRSS
QQRTTPRRS
BCCEAACDD
...

user output
GGHGGHGGH
GHHGHHGHH
EEFEEFEEF
EFFEFFEFF
GGHGGHGGH
...

Test 55

Verdict:

input
9 1

correct output
IMPOSSIBLE

user output
1IMPOSSIBLE

Test 56

Verdict: ACCEPTED

input
9 2

correct output
GG
HG
HH
JJ
FJ
...

user output
GG
GH
HH
GG
GH
...

Test 57

Verdict:

input
9 3

correct output
IMPOSSIBLE

user output
3IMPOSSIBLE

Test 58

Verdict: ACCEPTED

input
9 4

correct output
GGQQ
HGRQ
HHRR
JJTT
FJPT
...

user output
GGEE
GHEF
HHFF
GGEE
GHEF
...

Test 59

Verdict:

input
9 5

correct output
GGQQV
GMQVV
IMMXX
IITTX
FFTUU
...

user output
5IMPOSSIBLE

Test 60

Verdict: ACCEPTED

input
9 6

correct output
GGQQBB
HGRQCB
HHRRCC
JJOYYE
JOOYEE
...

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF
GGHGGH
...

Test 61

Verdict:

input
9 7

correct output
GGQQVGG
GMQVVHG
IMMXXHH
IITTXJJ
FFTUUFJ
...

user output
7IMPOSSIBLE

Test 62

Verdict: ACCEPTED

input
9 8

correct output
GGQQBBLL
HGRQCBML
HHRRCCMM
JJTTEEOO
FJPTAEKO
...

user output
GGEEGGEE
GHEFGHEF
HHFFHHFF
GGEEGGEE
GHEFGHEF
...

Test 63

Verdict:

input
9 9

correct output
GHHJJGGII
GGHJOGLIN
QQSOOLLNN
QVSSYVVXX
VVDYYVBXD
...

user output
9IMPOSSIBLE

Test 64

Verdict: ACCEPTED

input
9 10

correct output
GGIIFFHHJJ
GLINFKHMJO
LLNNKKMMOO
VVXXUUWWYY
VBXDUAWCYE
...

user output
GGEEGGEEGG
GHEFGHEFGH
HHFFHHFFHH
GGEEGGEEGG
GHEFGHEFGH
...
Truncated

Test 65

Verdict: ACCEPTED

input
10 3

correct output
GGL
GLL
IIN
INN
FFK
...

user output
GGH
GHH
EEF
EFF
GGH
...

Test 66

Verdict: ACCEPTED

input
10 6

correct output
GGLVVB
GLLVBB
IINXXD
INNXDD
FFKUUA
...

user output
GGHGGH
GHHGHH
EEFEEF
EFFEFF
GGHGGH
...

Test 67

Verdict: ACCEPTED

input
10 9

correct output
GGLVVBLLQ
GLLVBBLQQ
IINXXDNNS
INNXDDNSS
FFKUUAKKP
...

user output
GGHGGHGGH
GHHGHHGHH
EEFEEFEEF
EFFEFFEFF
GGHGGHGGH
...
Truncated

Test 68

Verdict: ACCEPTED

input
81 88

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 69

Verdict: ACCEPTED

input
32 27

correct output
GGLVVBLLQBBGQQVGGLVVBLLQBBG
GLLVBBLQQBGGQVVGLLVBBLQQBGG
IINXXDNNSDDISSXIINXXDNNSDDI
INNXDDNSSDIISXXINNXDDNSSDII
FFKUUAKKPAAFPPUFFKUUAKKPAAF
...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGH
GHHGHHGHHGHHGHHGHHGHHGHHGHH
EEFEEFEEFEEFEEFEEFEEFEEFEEF
EFFEFF

...
Truncated

Test 70

Verdict: ACCEPTED

input
63 76

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 71

Verdict: ACCEPTED

input
60 80

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 72

Verdict:

input
21 49

correct output
GHHJJGGIIFFHHJJGGIIFFHHJJGGIIF...

user output
49IMPOSSIBLE

Test 73

Verdict: ACCEPTED

input
66 88

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 74

Verdict: ACCEPTED

input
98 42

correct output
GGLVVBLLQBBGQQVGGLVVBLLQBBGQQV...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 75

Verdict:

input
21 67

correct output
GHHJJGGIIFFHHJJGGIIFFHHJJGGIIF...

user output
67IMPOSSIBLE

Test 76

Verdict:

input
87 13

correct output
GGQQVGGQQBBLL
GMQVVHGRQCBML
IMMXXHHRRCCMM
IITTXJJTTEEOO
FFTUUFJPTAEKO
...

user output
13IMPOSSIBLE

Test 77

Verdict:

input
60 67

correct output
GHHJJGGIIFFHHJJGGIIFFHHJJGGIIF...

user output
67IMPOSSIBLE

Test 78

Verdict:

input
13 57

correct output
GGIIFGGIIFFHHJJGGIIFFHHJJGGIIF...

user output
57IMPOSSIBLE

Test 79

Verdict: ACCEPTED

input
50 12

correct output
GGLVVBLLQBBG
GLLVBBLQQBGG
IINXXDNNSDDI
INNXDDNSSDII
FFKUUAKKPAAF
...

user output
GGHGGHGGHGGH
GHHGHHGHHGHH
EEFEEFEEFEEF
EFFEFFEFFEFF
GGHGGHGGHGGH
...
Truncated

Test 80

Verdict:

input
21 39

correct output
GHHJJGGIIFFHHJJGGIIFFHHJJGGIIF...

user output
39IMPOSSIBLE

Test 81

Verdict: ACCEPTED

input
19 66

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 82

Verdict: ACCEPTED

input
86 72

correct output
GGLVVBLLQBBGQQVGGLVVBLLQBBGQQV...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 83

Verdict: ACCEPTED

input
46 66

correct output
GHHJFFHIIFGGIJJGHHJFFHIIFGGIJJ...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 84

Verdict: ACCEPTED

input
96 72

correct output
GGLVVBLLQBBGQQVGGLVVBLLQBBGQQV...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 85

Verdict: ACCEPTED

input
93 40

correct output
GGQQBBLLVVGGQQBBLLVVGGQQBBLLVV...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 86

Verdict: ACCEPTED

input
92 69

correct output
GGLVVBLLQBBGQQVGGLVVBLLQBBGQQV...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 87

Verdict: ACCEPTED

input
13 96

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGHGGHGGHGGHGGHGGHGGHGGHGGHGGH...
Truncated

Test 88

Verdict:

input
3 99

correct output
IMPOSSIBLE

user output
99IMPOSSIBLE

Test 89

Verdict: ACCEPTED

input
3 100

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 90

Verdict: ACCEPTED

input
99 100

correct output
GGIIFFHHJJGGIIFFHHJJGGIIFFHHJJ...

user output
GGEEGGEEGGEEGGEEGGEEGGEEGGEEGG...
Truncated

Test 91

Verdict:

input
100 100

correct output
IMPOSSIBLE

user output
(empty)