#2505
jocxzero
Pe o foaie dintr-un caiet de matematică de dimensiune N x M
(N
numărul de linii și M
numărul de coloane) sunt completate toate pătrățelele cu X
sau 0
. Pentru un număr natural K
dat, numim șir corect, o secvență de K
elemente consecutive pe linie, coloană sau diagonale care au aceeași valoare (X
sau 0
). Două pătrățele de pe foaie sunt vecine pe aceeași diagonală dacă au un singur colț comun.
Exemplu din figura alăturată, pentru care N=4
, M=5
, K=3
conține 6
șiruri corecte de X
și 5
șiruri corecte de 0
.
Cerințe:
N
, M
și K
și o foaie de matematică plină cu X
și 0
. Determinați câte șiruri corecte de X
și câte șiruri corecte de 0
se găsesc pe foaia dată.Q
întrebări de forma A B
, în care A
este caracterul X
sau 0
și B
este un număr natural. Determinați în câte moduri putem tăia foaia de matematica vertical pentru a obține în subtabloul din partea stângă exact B
șiruri corecte de A
. Foia se poate tăia în M -1
variante: după prima coloană, a doua coloană, după a treia coloană, ș.a.m.d, până după penultima coloană.ONIG 2018
Problema | jocxzero | Operații I/O |
jocxzero.in /jocxzero.out
|
---|---|---|---|
Limita timp | 0.7 secunde | Limita memorie |
Total: 64 MB
/
Stivă 32 MB
|
Id soluție | #52394957 | Utilizator | |
Fișier | jocxzero.cpp | Dimensiune | 3.99 KB |
Data încărcării | 28 Septembrie 2024, 22:33 | Scor / rezultat | Eroare de compilare |
jocxzero.cpp:2:10: error: too many decimal points in number aa:array[0..102,0..10002]of byte; ^ jocxzero.cpp:2:17: error: too many decimal points in number aa:array[0..102,0..10002]of byte; ^ jocxzero.cpp:3:22: error: too many decimal points in number sus,st,sts,stj:array[0..102,0..10002] of longint; ^ jocxzero.cpp:3:29: error: too many decimal points in number sus,st,sts,stj:array[0..102,0..10002] of longint; ^ jocxzero.cpp:4:10: error: too many decimal points in number bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:4:38: error: too many decimal points in number bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:4:43: error: too many decimal points in number bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:5:9: error: too many decimal points in number d:array[0..2]of longint; ^ jocxzero.cpp:44:14: warning: character constant too long for its type [enabled by default] assign(f,'jocxzero.in'); reset(f); ^ jocxzero.cpp:45:14: warning: character constant too long for its type [enabled by default] assign(g,'jocxzero.out');rewrite(g); ^ jocxzero.cpp:53:14: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix] if c='X'then aa[j,i]:=1 ^ jocxzero.cpp:1:1: error: 'var' does not name a type var f,g:text; c:char; ^ jocxzero.cpp:1:17: error: 'c' does not name a type var f,g:text; c:char; ^ jocxzero.cpp:2:3: error: found ':' in nested-name-specifier, expected '::' aa:array[0..102,0..10002]of byte; ^ jocxzero.cpp:2:1: error: 'aa' does not name a type aa:array[0..102,0..10002]of byte; ^ jocxzero.cpp:3:1: error: 'sus' does not name a type sus,st,sts,stj:array[0..102,0..10002] of longint; ^ jocxzero.cpp:4:3: error: found ':' in nested-name-specifier, expected '::' bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:4:1: error: 'bb' does not name a type bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:4:31: error: found ':' in nested-name-specifier, expected '::' bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:4:28: error: 'sir' does not name a type bb:array[0..4] of longint; sir:array[0..2,0..10002]of longint; ^ jocxzero.cpp:5:2: error: found ':' in nested-name-specifier, expected '::' d:array[0..2]of longint; ^ jocxzero.cpp:5:1: error: 'd' does not name a type d:array[0..2]of longint; ^ jocxzero.cpp:6:1: error: 'i' does not name a type i,j,n,m,k,q,a,b,p,x,max1,p1,p2:longint; ^ jocxzero.cpp:7:1: error: 'function' does not name a type function cbinarp(a,b,u:longint):longint; ^ jocxzero.cpp:8:1: error: 'var' does not name a type var i,j,k,ok:longint; ^ jocxzero.cpp:9:1: error: 'begin' does not name a type begin ^ jocxzero.cpp:11:18: error: 'ok' does not name a type cbinarp:=-1; ok:=0; ^ jocxzero.cpp:12:5: error: expected unqualified-id before 'if' if (b<sir[a,1])and(ok=0) then begin cbinarp:=-1;ok:=1 end; ^ jocxzero.cpp:12:53: error: 'ok' does not name a type if (b<sir[a,1])and(ok=0) then begin cbinarp:=-1;ok:=1 end; ^ jocxzero.cpp:13:5: error: expected unqualified-id before 'if' if (b>sir[a,u])and(ok=0) then begin cbinarp:=-1;ok:=1 end; ^ jocxzero.cpp:13:53: error: 'ok' does not name a type if (b>sir[a,u])and(ok=0) then begin cbinarp:=-1;ok:=1 end; ^ jocxzero.cpp:14:5: error: expected unqualified-id before 'if' if (b=sir[a,1])and(ok=0) then begin cbinarp:=1;ok:=1 end; ^ jocxzero.cpp:14:52: error: 'ok' does not name a type if (b=sir[a,1])and(ok=0) then begin cbinarp:=1;ok:=1 end; ^ jocxzero.cpp:15:5: error: 'i' does not name a type i:=1;j:=u; ^ jocxzero.cpp:15:10: error: 'j' does not name a type i:=1;j:=u; ^ jocxzero.cpp:16:5: error: expected unqualified-id before 'while' while (i<=j) and (ok=0) do ^ jocxzero.cpp:19:11: error: expected unqualified-id before 'if' if (sir[a,k]=b)and(sir[a,k-1]<b) then begin cbinarp:=k;ok:=1;end ^ jocxzero.cpp:19:66: error: 'ok' does not name a type if (sir[a,k]=b)and(sir[a,k-1]<b) then begin cbinarp:=k;ok:=1;end ^ jocxzero.cpp:19:72: error: 'end' does not name a type if (sir[a,k]=b)and(sir[a,k-1]<b) then begin cbinarp:=k;ok:=1;end ^ jocxzero.cpp:22:11: error: 'end' does not name a type end; ^ jocxzero.cpp:23:5: error: expected unqualified-id before 'if' if ok=0 then cbinarp:=-1; ^ jocxzero.cpp:24:1: error: 'end' does not name a type end; ^ jocxzero.cpp:26:1: error: 'function' does not name a type function cbinaru(a,b,u:longint):longint; ^ jocxzero.cpp:27:1: error: 'var' does not name a type var i,j,k,ok:longint; ^ jocxzero.cpp:28:1: error: 'begin' does not name a type begin ^ jocxzero.cpp:29:18: error: 'ok' does not name a type cbinaru:=-1; ok:=0; ^ jocxzero.cpp:30:6: error: expected unqualified-id before 'if' if (b<sir[a,1])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:30:55: error: 'ok' does not name a type if (b<sir[a,1])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:30:61: error: 'end' does not name a type if (b<sir[a,1])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:31:6: error: expected unqualified-id before 'if' if (b>sir[a,u])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:31:54: error: 'ok' does not name a type if (b>sir[a,u])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:31:60: error: 'end' does not name a type if (b>sir[a,u])and(ok=0) then begin cbinaru:=-1;ok:=1;end; ^ jocxzero.cpp:32:6: error: expected unqualified-id before 'if' if (b=sir[a,u])and(ok=0) then begin cbinaru:=u;ok:=1;end; ^ jocxzero.cpp:32:53: error: 'ok' does not name a type if (b=sir[a,u])and(ok=0) then begin cbinaru:=u;ok:=1;end; ^ jocxzero.cpp:32:59: error: 'end' does not name a type if (b=sir[a,u])and(ok=0) then begin cbinaru:=u;ok:=1;end; ^ jocxzero.cpp:33:6: error: 'i' does not name a type i:=1;j:=u; ^ jocxzero.cpp:33:11: error: 'j' does not name a type i:=1;j:=u; ^ jocxzero.cpp:34:6: error: expected unqualified-id before 'while' while(i<=j) and(ok=0) do ^ jocxzero.cpp:37:12: error: expected unqualified-id before 'if' if(sir[a,k]=b) and((sir[a,k+1]>b) or(k=u)) then begin cbinaru:=k;ok:=1;end ^ jocxzero.cpp:37:77: error: 'ok' does not name a type if(sir[a,k]=b) and((sir[a,k+1]>b) or(k=u)) then begin cbinaru:=k;ok:=1;end ^ jocxzero.cpp:37:83: error: 'end' does not name a type if(sir[a,k]=b) and((sir[a,k+1]>b) or(k=u)) then begin cbinaru:=k;ok:=1;end ^ jocxzero.cpp:40:12: error: 'end' does not name a type end; ^ jocxzero.cpp:41:6: error: expected unqualified-id before 'if' if ok=0 then cbinaru:=-1; ^ jocxzero.cpp:42:1: error: 'end' does not name a type end; ^ jocxzero.cpp:43:1: error: 'begin' does not name a type begin ^ jocxzero.cpp:44:35: error: expected constructor, destructor, or type conversion before '(' token assign(f,'jocxzero.in'); reset(f); ^ jocxzero.cpp:45:11: error: expected constructor, destructor, or type conversion before '(' token assign(g,'jocxzero.out');rewrite(g); ^ jocxzero.cpp:45:37: error: expected constructor, destructor, or type conversion before '(' token assign(g,'jocxzero.out');rewrite(g); ^ jocxzero.cpp:46:11: error: expected constructor, destructor, or type conversion before '(' token readln(f,p); ^ jocxzero.cpp:47:11: error: expected constructor, destructor, or type conversion before '(' token readln(f,n,m,k); ^ jocxzero.cpp:48:5: error: expected unqualified-id before 'for' for j:= 1 to n do ^ jocxzero.cpp:53:9: error: expected unqualified-id before 'if' if c='X'then aa[j,i]:=1 ^ jocxzero.cpp:55:9: error: 'end' does not name a type end; ^ jocxzero.cpp:56:15: error: expected constructor, destructor, or type conversion before '(' token readln(f); ^ jocxzero.cpp:57:9: error: 'end' does not name a type end; ^ jocxzero.cpp:58:5: error: expected unqualified-id before '{' token {for i:=1 to n do ^ jocxzero.cpp:63:6: error: 'st' does not name a type st[1,1]:=1;sus[1,1]:=1;sts[1,1]:=1; ^ jocxzero.cpp:63:17: error: 'sus' does not name a type st[1,1]:=1;sus[1,1]:=1;sts[1,1]:=1; ^ jocxzero.cpp:63:29: error: 'sts' does not name a type st[1,1]:=1;sus[1,1]:=1;sts[1,1]:=1; ^ jocxzero.cpp:64:6: error: expected unqualified-id before 'for' for j:=2 to m do ^ jocxzero.cpp:68:12: error: 'sus' does not name a type sus[1,j]:=1; ^ jocxzero.cpp:69:12: error: 'sts' does not name a type sts[1,j]:=1; ^ jocxzero.cpp:70:9: error: 'end' does not name a type end; ^ jocxzero.cpp:71:6: error: expected unqualified-id before 'for' for i:=2 to n do ^ jocxzero.cpp:75:13: error: 'st' does not name a type st[i,1]:=1; ^ jocxzero.cpp:76:13: error: 'sts' does not name a type sts[i,1]:=1; ^ jocxzero.cpp:77:9: error: 'end' does not name a type end; ^ jocxzero.cpp:78:6: error: expected unqualified-id before 'for' for i:=2 to n do ^ jocxzero.cpp:82:17: error: expected unqualified-id before 'if' if aa[i,j]=aa[i-1,j] then sus[i,j]:=sus[i-1,j]+1 else sus[i,j]:=1; ^ jocxzero.cpp:83:17: error: expected unqualified-id before 'if' if aa[i,j]=aa[i-1,j-1] then sts[i,j]:=sts[i-1,j-1]+1 else sts[i,j]:=1; ^ jocxzero.cpp:84:13: error: 'end' does not name a type end; ^ jocxzero.cpp:85:6: error: expected unqualified-id before 'for' for i:=n downto 1 do stj[i,1]:=1; ^ jocxzero.cpp:86:6: error: expected unqualified-id before 'for' for j:=2 to m do stj[n,j]:=1; ^ jocxzero.cpp:87:6: error: expected unqualified-id before 'for' for i:=n-1 downto 1 do ^ jocxzero.cpp:90:6: error: expected unqualified-id before 'for' for i:= 1 to n do ^ jocxzero.cpp:94:17: error: expected unqualified-id before 'if' if sus[i,j]>=k then inc(bb[x]); ^ jocxzero.cpp:95:17: error: expected unqualified-id before 'if' if st[i,j]>=k then inc(bb[x]); ^ jocxzero.cpp:96:17: error: expected unqualified-id before 'if' if sts[i,j]>=k then inc(bb[x]); ^ jocxzero.cpp:97:17: error: expected unqualified-id before 'if' if stj[i,j]>=k then inc(bb[x]); ^ jocxzero.cpp:98:13: error: 'end' does not name a type end; ^ jocxzero.cpp:99:6: error: expected unqualified-id before 'if' if p=1 then writeln(g,bb[1],' ',bb[0]) ^ jocxzero.cpp:104:25: error: 'd' does not name a type d[0]:=0;d[1]:=0; ^ jocxzero.cpp:105:17: error: expected unqualified-id before 'for' for i:=1 to n do ^ jocxzero.cpp:108:28: error: expected unqualified-id before 'if' if st[i,j]>=k then inc(d[x]); ^ jocxzero.cpp:109:28: error: expected unqualified-id before 'if' if sus[i,j]>=k then inc(d[x]); ^ jocxzero.cpp:110:28: error: expected unqualified-id before 'if' if sts[i,j]>=k then inc(d[x]); ^ jocxzero.cpp:111:28: error: expected unqualified-id before 'if' if stj[i,j]>=k then inc(d[x]); ^ jocxzero.cpp:112:21: error: 'end' does not name a type end; ^ jocxzero.cpp:113:17: error: 'sir' does not name a type sir[1,j]:=sir[1,j-1]+d[1]; ^ jocxzero.cpp:114:17: error: 'sir' does not name a type sir[0,j]:=sir[0,j-1]+d[0]; ^ jocxzero.cpp:115:13: error: 'end' does not name a type end; ^ jocxzero.cpp:116:15: error: expected constructor, destructor, or type conversion before '(' token readln(f,q); ^ jocxzero.cpp:117:9: error: expected unqualified-id before 'for' for i:= 1 to q do ^ jocxzero.cpp:120:17: error: expected unqualified-id before 'if' if c='X' then a:=1 else a:=0; ^ jocxzero.cpp:121:17: error: 'p1' does not name a type p1:=cbinarp(a,b,m-1); ^ jocxzero.cpp:122:17: error: 'p2' does not name a type p2:=cbinaru(a,b,m-1); ^ jocxzero.cpp:123:17: error: expected unqualified-id before 'if' if p1=-1 then writeln(g,0) ^ jocxzero.cpp:125:13: error: 'end' does not name a type end; ^ jocxzero.cpp:126:6: error: 'end' does not name a type end; ^ jocxzero.cpp:127:10: error: expected constructor, destructor, or type conversion before '(' token close(f); ^ jocxzero.cpp:128:10: error: expected constructor, destructor, or type conversion before '(' token close(g); ^ jocxzero.cpp:129:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema jocxzero face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.