Submission #100404

#TimeUsernameProblemLanguageResultExecution timeMemory
1004041KhanLand of the Rainbow Gold (APIO17_rainbow)C++14
Compilation error
0 ms0 KiB
// In the name of GOD #include "rainbow.h" #include <bits/stdc++.h> #include <ext/rope> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_cxx; using namespace __gnu_pbds; #define BeGood ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define orset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define nl '\n' #define ff first #define ss second #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define pb push_back typedef long long ll; typedef double db; const int N = 1e4 + 5; const int M = 1e9 + 7; void init(int R, int C, int sr, int sc, int M, char *S){ BeGood cin >> n >> k >> slen >> q; int x, y; cin >> x >> y; cin >> s; if(n <= 55 && k <= 55){ int a[111][111]; for(int i = 1; i <= n; ++i){ for(int j = 1; j <= k; ++j){ a[i][j] = 0; } } for(int i = 1; i <= n; ++i){ for(int j = 1; j <= k; ++j){ a[i][j] = 0; } } for(int i = 0; i < slen; ++i){ a[x][y] = 1; if(s[i] == 'N'){ x--; } if(s[i] == 'W'){ y--; } if(s[i] == 'S'){ x++; } if(s[i] == 'E'){ y++; } } a[x][y] = 1; while(q){ int x1, y1, x2, y2; colours(x1, y1, x2, y1); q--; } } else{ int a[5][100111]; } } int colours(int ar, int ac, int br, int bc){ int ans = 0; vector<int> t[55]; for(int i = 0; i < 54; ++i){ t[i].resize(k + 2, 0); } int ans = 0; for(int i = x1; i <= x2; ++i){ for(int j = y1; j <= y2; ++j){ if(a[i][j] == 0){ if(t[i - 1][j] != 2 && t[i + 1][j] != 2 && t[i][j - 1] != 2 && t[i][j + 1] != 2){ ans++; } t[i][j] = 2; } } } return ans; }

Compilation message (stderr)

rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:32:13: error: 'n' was not declared in this scope
      cin >> n >> k >> slen >> q;
             ^
rainbow.cpp:32:18: error: 'k' was not declared in this scope
      cin >> n >> k >> slen >> q;
                  ^
rainbow.cpp:32:23: error: 'slen' was not declared in this scope
      cin >> n >> k >> slen >> q;
                       ^~~~
rainbow.cpp:32:23: note: suggested alternative: 'wcslen'
      cin >> n >> k >> slen >> q;
                       ^~~~
                       wcslen
rainbow.cpp:32:31: error: 'q' was not declared in this scope
      cin >> n >> k >> slen >> q;
                               ^
rainbow.cpp:35:13: error: 's' was not declared in this scope
      cin >> s;
             ^
rainbow.cpp:67:16: error: 'colours' was not declared in this scope
                colours(x1, y1, x2, y1);
                ^~~~~~~
rainbow.cpp:67:16: note: suggested alternative: 'colour'
                colours(x1, y1, x2, y1);
                ^~~~~~~
                colour
rainbow.cpp:66:32: warning: unused variable 'y2' [-Wunused-variable]
                int x1, y1, x2, y2;
                                ^~
rainbow.cpp:71:15: warning: unused variable 'a' [-Wunused-variable]
           int a[5][100111];
               ^
rainbow.cpp: In function 'int colours(int, int, int, int)':
rainbow.cpp:79:33: error: 'k' was not declared in this scope
                     t[i].resize(k + 2, 0);
                                 ^
rainbow.cpp:81:20: error: redeclaration of 'int ans'
                int ans = 0;
                    ^~~
rainbow.cpp:76:10: note: 'int ans' previously declared here
      int ans = 0;
          ^~~
rainbow.cpp:82:28: error: 'x1' was not declared in this scope
                for(int i = x1; i <= x2; ++i){
                            ^~
rainbow.cpp:82:28: note: suggested alternative: 'y1'
                for(int i = x1; i <= x2; ++i){
                            ^~
                            y1
rainbow.cpp:82:37: error: 'x2' was not declared in this scope
                for(int i = x1; i <= x2; ++i){
                                     ^~
rainbow.cpp:83:33: error: invalid conversion from 'double (*)(double) throw ()' to 'int' [-fpermissive]
                     for(int j = y1; j <= y2; ++j){
                                 ^~
rainbow.cpp:83:42: error: 'y2' was not declared in this scope
                     for(int j = y1; j <= y2; ++j){
                                          ^~
rainbow.cpp:83:42: note: suggested alternative: 'yn'
                     for(int j = y1; j <= y2; ++j){
                                          ^~
                                          yn
rainbow.cpp:84:29: error: 'a' was not declared in this scope
                          if(a[i][j] == 0){
                             ^