int c1, c2, c3, ug;
in >> c1 >> c2 >> c3 >> ug;
if ( ug % 2 == 0 ) {
}
vector< vector< int >> res( 5 , vector< int > ( 800 , 0 ) ) ;
int firstRow = 1 ;
int lastRow = 3 ;
int lastCol;
int num = 2 ;
if ( ug % 2 == 1 ) {
res[ 1 ] [ 0 ] = 1 ;
res[ 1 ] [ 1 ] = 1 ;
res[ 2 ] [ 0 ] = 1 ;
res[ 3 ] [ 0 ] = 2 ;
res[ 3 ] [ 1 ] = 2 ;
int topCnt = 2 ;
int botCnt = 2 ;
-- ug;
-- c2;
-- c3;
for ( int i = 0 ; i < ug / 2 ; ++ i) {
++ num;
if ( topCnt < botCnt) {
res[ 1 ] [ topCnt] = num;
res[ 0 ] [ topCnt] = num;
++ topCnt;
res[ 0 ] [ topCnt] = num;
++ topCnt;
++ num;
res[ 1 ] [ topCnt] = num;
res[ 0 ] [ topCnt] = num;
++ topCnt;
res[ 1 ] [ topCnt] = num;
++ topCnt;
firstRow = 0 ;
} else {
res[ 3 ] [ botCnt] = num;
res[ 4 ] [ botCnt] = num;
++ botCnt;
res[ 4 ] [ botCnt] = num;
++ botCnt;
++ num;
res[ 3 ] [ botCnt] = num;
res[ 4 ] [ botCnt] = num;
++ botCnt;
res[ 3 ] [ botCnt] = num;
++ botCnt;
lastRow = 4 ;
}
}
for ( int i = 0 ; i < c3; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 3 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 3 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
for ( int i = 0 ; i < c2; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 2 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 2 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
for ( int i = 0 ; i < c1; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 1 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 1 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
cerr << topCnt << ' ' << botCnt << endl;
assert ( topCnt == botCnt) ;
++ num;
res[ 1 ] [ topCnt] = num;
res[ 2 ] [ topCnt] = num;
res[ 3 ] [ topCnt] = num;
lastCol = topCnt;
} else {
res[ 1 ] [ 0 ] = 1 ;
res[ 1 ] [ 1 ] = 1 ;
res[ 2 ] [ 0 ] = 1 ;
res[ 3 ] [ 0 ] = 2 ;
res[ 3 ] [ 1 ] = 2 ;
res[ 3 ] [ 2 ] = 2 ;
int topCnt = 2 ;
int botCnt = 3 ;
-- ug;
-- ug;
-- c3;
-- c3;
for ( int i = 0 ; i < ug / 2 ; ++ i) {
++ num;
if ( topCnt < botCnt) {
res[ 1 ] [ topCnt] = num;
res[ 0 ] [ topCnt] = num;
++ topCnt;
res[ 0 ] [ topCnt] = num;
++ topCnt;
++ num;
res[ 1 ] [ topCnt] = num;
res[ 0 ] [ topCnt] = num;
++ topCnt;
res[ 1 ] [ topCnt] = num;
++ topCnt;
firstRow = 0 ;
} else {
res[ 3 ] [ botCnt] = num;
res[ 4 ] [ botCnt] = num;
++ botCnt;
res[ 4 ] [ botCnt] = num;
++ botCnt;
++ num;
res[ 3 ] [ botCnt] = num;
res[ 4 ] [ botCnt] = num;
++ botCnt;
res[ 3 ] [ botCnt] = num;
++ botCnt;
lastRow = 4 ;
}
}
for ( int i = 0 ; i < c3; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 3 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 3 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
for ( int i = 0 ; i < c2; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 2 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 2 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
for ( int i = 0 ; i < c1; ++ i) {
++ num;
if ( topCnt < botCnt) {
for ( int j: range( 1 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
} else {
for ( int j: range( 1 ) ) {
res[ 3 ] [ botCnt] = num;
++ botCnt;
}
}
}
cerr << topCnt << ' ' << botCnt << endl;
assert ( topCnt + 1 == botCnt) ;
++ num;
for ( int j: range( 3 ) ) {
res[ 1 ] [ topCnt] = num;
++ topCnt;
}
++ num;
res[ 3 ] [ botCnt] = num;
res[ 3 ] [ botCnt + 1 ] = num;
res[ 2 ] [ botCnt + 1 ] = num;
lastCol = botCnt + 1 ;
}
out << ( lastRow - firstRow + 1 ) << ' ' << lastCol + 1 << "\n " ;
for ( int i: inclusiveRange( firstRow, lastRow) ) {
for ( int j: inclusiveRange( 0 , lastCol) ) {
out << res[ i] [ j] << " " ;
}
out << "\n " ;
}
CQlpbnQgYzEsIGMyLCBjMywgdWc7CgkJaW4gPj4gYzEgPj4gYzIgPj4gYzMgPj4gdWc7CgoJCWlmICh1ZyAlIDIgPT0gMCkgewoKCQl9CgoJCXZlY3Rvcjx2ZWN0b3I8aW50Pj4gcmVzKDUsIHZlY3RvcjxpbnQ+KDgwMCwgMCkpOwoKCQlpbnQgZmlyc3RSb3cgPSAxOwoJCWludCBsYXN0Um93ID0gMzsKCQlpbnQgbGFzdENvbDsKCQlpbnQgbnVtID0gMjsKCQlpZiAodWcgJSAyID09IDEpIHsKCQkJcmVzWzFdWzBdID0gMTsKCQkJcmVzWzFdWzFdID0gMTsKCQkJcmVzWzJdWzBdID0gMTsKCQkJcmVzWzNdWzBdID0gMjsKCQkJcmVzWzNdWzFdID0gMjsKCgkJCWludCB0b3BDbnQgPSAyOwoJCQlpbnQgYm90Q250ID0gMjsKCgkJCS0tdWc7CgkJCS0tYzI7CgkJCS0tYzM7CgoJCQlmb3IgKGludCBpID0gMDsgaSA8IHVnIC8gMjsgKytpKSB7CgkJCQkrK251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kJcmVzWzJdW2JvdENudCArIDFdID0gbnVtOwoJCQlsYXN0Q29sID0gYm90Q250ICsgMTsKCQl9CgoKCQlvdXQgPDwgKGxhc3RSb3cgLSBmaXJzdFJvdyArIDEpIDw8ICcgJyA8PCBsYXN0Q29sICsgMSA8PCAiXG4iOwoJCWZvciAoaW50IGk6IGluY2x1c2l2ZVJhbmdlKGZpcnN0Um93LCBsYXN0Um93KSkgewoJCQlmb3IgKGludCBqOiBpbmNsdXNpdmVSYW5nZSgwLCBsYXN0Q29sKSkgewoJCQkJb3V0IDw8IHJlc1tpXVtqXSA8PCAiICI7CgkJCX0KCQkJb3V0IDw8ICJcbiI7CgkJfQ==
compilation info
prog.cpp:2:3: error: ‘in’ does not name a type
in >> c1 >> c2 >> c3 >> ug;
^~
prog.cpp:4:3: error: expected unqualified-id before ‘if’
if (ug % 2 == 0) {
^~
prog.cpp:8:3: error: ‘vector’ does not name a type
vector<vector<int>> res(5, vector<int>(800, 0));
^~~~~~
prog.cpp:14:3: error: expected unqualified-id before ‘if’
if (ug % 2 == 1) {
^~
stdout