Submission #435021

#TimeUsernameProblemLanguageResultExecution timeMemory
435021hossain2020Land of the Rainbow Gold (APIO17_rainbow)C++14
Compilation error
0 ms0 KiB
#include "rainbow.h" #include <bits/stdc++.h> #include <map> #include <iostream> map < pair <int,int > ,int > a,b; int h=1,o=0,r,c; void init(int R, int C, int sr, int sc, int m, char *s) { r=R; c=C; a{sc,sr}=1; int x=sc,y=sr; b{x,y}=-1; for (int i=0;i<m;i++) { if (*s=='W')x--; else if (*s=='E')x++; else if (*s=='N')y--; else y++; a{x,y}=1; b{x,y}=-1; s++; } } void vis(int i,int j,int ar, int ac, int br, int bc) { b{i,j}=h; if (b{i-1,j}!=h&&b{i-1,j}!=-1&&i-1>=ac)vis(i-1,j,ar,ac,br,bc); if (b{i,j-1}!=h&&b{i,j-1}!=-1&&j-1>=ar)vis(i,j-1,ar,ac,br,bc); if (b{i+1,j}!=h&&b{i+1,j}!=-1&&i+1<=bc)vis(i+1,j,ar,ac,br,bc); if (b{i,j+1}!=h&&b{i,j+1}!=-1&&j+1<=br)vis(i,j+1,ar,ac,br,bc); } int f(int i,int j,int ar, int ac, int br, int bc) { if (b{i,j}==h||b{i,j}==-1) { return 0; } vis(i,j,ar,ac,br,bc); return 1; } int colour(int ar, int ac, int br, int bc) { o=0; for (int i=ac;i<=bc;i++) { for (int j=ar;j<=br;j++) { o+=f(i,j,ar,ac,br,bc); } } h++; return o; }

Compilation message (stderr)

rainbow.cpp:6:1: error: 'map' does not name a type
    6 | map < pair <int,int > ,int > a,b;
      | ^~~
rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:12:5: error: 'a' was not declared in this scope
   12 |     a{sc,sr}=1;
      |     ^
rainbow.cpp:12:13: error: expected primary-expression before '=' token
   12 |     a{sc,sr}=1;
      |             ^
rainbow.cpp:14:5: error: 'b' was not declared in this scope
   14 |     b{x,y}=-1;
      |     ^
rainbow.cpp:14:11: error: expected primary-expression before '=' token
   14 |     b{x,y}=-1;
      |           ^
rainbow.cpp:21:10: error: expected ';' before '{' token
   21 |         a{x,y}=1;
      |          ^
      |          ;
rainbow.cpp:21:15: error: expected primary-expression before '=' token
   21 |         a{x,y}=1;
      |               ^
rainbow.cpp:22:10: error: expected ';' before '{' token
   22 |         b{x,y}=-1;
      |          ^
      |          ;
rainbow.cpp:22:15: error: expected primary-expression before '=' token
   22 |         b{x,y}=-1;
      |               ^
rainbow.cpp: In function 'void vis(int, int, int, int, int, int)':
rainbow.cpp:28:5: error: 'b' was not declared in this scope
   28 |     b{i,j}=h;
      |     ^
rainbow.cpp:28:11: error: expected primary-expression before '=' token
   28 |     b{i,j}=h;
      |           ^
rainbow.cpp:29:10: error: expected ')' before '{' token
   29 |     if (b{i-1,j}!=h&&b{i-1,j}!=-1&&i-1>=ac)vis(i-1,j,ar,ac,br,bc);
      |        ~ ^
      |          )
rainbow.cpp:30:10: error: expected ')' before '{' token
   30 |     if (b{i,j-1}!=h&&b{i,j-1}!=-1&&j-1>=ar)vis(i,j-1,ar,ac,br,bc);
      |        ~ ^
      |          )
rainbow.cpp:31:10: error: expected ')' before '{' token
   31 |     if (b{i+1,j}!=h&&b{i+1,j}!=-1&&i+1<=bc)vis(i+1,j,ar,ac,br,bc);
      |        ~ ^
      |          )
rainbow.cpp:32:10: error: expected ')' before '{' token
   32 |     if (b{i,j+1}!=h&&b{i,j+1}!=-1&&j+1<=br)vis(i,j+1,ar,ac,br,bc);
      |        ~ ^
      |          )
rainbow.cpp: In function 'int f(int, int, int, int, int, int)':
rainbow.cpp:36:9: error: 'b' was not declared in this scope
   36 |     if (b{i,j}==h||b{i,j}==-1)
      |         ^
rainbow.cpp:36:10: error: expected ')' before '{' token
   36 |     if (b{i,j}==h||b{i,j}==-1)
      |        ~ ^
      |          )