Submission #510245

#TimeUsernameProblemLanguageResultExecution timeMemory
510245khaled_whebeTetris (COCI17_tetris)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define endl '\n' typedef long long ll; using namespace std; const int N=555555; ll n,m,first,sec,thrd,frth,ffth; char a[100][100]; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>m; for (ll i=0;i<n;i++) { for (ll j=0;j<m;j++) cin>>a[i][j]; } for (ll i=0;i<n;i++) { for (ll j=0;j<m;j++) { if (a[i][j]>=97&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]) first++; else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3])||((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j])(&&a[i][j]==a[i+3][j])))) sec++; else if (a[i][j]>=97&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+2][j+1])) thrd++; else if (a[i][j]>=97&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1])) frth++; else if (a[i][j]>=97&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j-1])) ffth++; } } cout<<first<<endl<<sec<<endl<<thrd<<endl<<frth<<endl<<ffth<<endl; return 0; }

Compilation message (stderr)

tetris.cpp: In function 'int main()':
tetris.cpp:23:143: error: expected ')' before '[' token
   23 |             else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3])||((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j])(&&a[i][j]==a[i+3][j]))))
      |                                                                                                                                           ~   ^
      |                                                                                                                                               )
tetris.cpp:23:160: error: expression cannot be used as a function
   23 |             else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3])||((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j])(&&a[i][j]==a[i+3][j]))))
      |                                                                                                                                                                ^
tetris.cpp:25:33: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   25 |             else if (a[i][j]>=97&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+2][j+1]))
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tetris.cpp:27:33: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   27 |             else if (a[i][j]>=97&&(a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j+2])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j-1]&&a[i][j]==a[i+2][j-1]))
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tetris.cpp:29:33: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   29 |             else if (a[i][j]>=97&&(a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]&&a[i][j]==a[i+1][j-1])||(a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j+1])||(a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j]&&a[i][j]==a[i+1][j-1]))
      |                      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tetris.cpp:23:142: error: label 'a' used but not defined
   23 |             else if (a[i][j]>=97&&((a[i][j]==a[i][j+1]&&a[i][j]==a[i][j+2]&&a[i][j]==a[i][j+3])||((a[i][j]==a[i+1][j]&&a[i][j]==a[i+2][j])(&&a[i][j]==a[i+3][j]))))
      |                                                                                                                                              ^