Submission #149042

#TimeUsernameProblemLanguageResultExecution timeMemory
149042Outfraware Boat People (#200)FunctionCup Museum (FXCUP4_museum)C++17
Compilation error
0 ms0 KiB
#include "museum.h" #include <string> #include <algorithm> #include <map> void score(map<string, int>& m, int i, int j) { string s; s.append(to_string(i)); s.append(to_string(j)); sort(s.begin(), s.end()); m[s]++; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); map<string, int> m; for (int i = 0; i < N; i++) { int candB = B[i]; int candT = T[i]; int candG = G[i]; for (int j = 0; j < N; j++) { // 같으면 continue if (i == j) { continue; } string s; if (candB == B[j]) { score(m, i, j); continue; } if (candT == T[j]) { score(m, i, j); continue; } if (candG == G[j]) { score(m, i, j); continue; } } } return m.size(); }

Compilation message (stderr)

museum.cpp:7:12: error: variable or field 'score' declared void
 void score(map<string, int>& m, int i, int j) {
            ^~~
museum.cpp:7:12: error: 'map' was not declared in this scope
museum.cpp:7:12: note: suggested alternative:
In file included from /usr/include/c++/7/map:61:0,
                 from museum.cpp:5:
/usr/include/c++/7/bits/stl_map.h:99:11: note:   'std::map'
     class map
           ^~~
museum.cpp:7:16: error: 'string' was not declared in this scope
 void score(map<string, int>& m, int i, int j) {
                ^~~~~~
museum.cpp:7:16: note: suggested alternatives:
In file included from /usr/include/c++/7/string:39:0,
                 from museum.cpp:3:
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
museum.cpp:7:24: error: expected primary-expression before 'int'
 void score(map<string, int>& m, int i, int j) {
                        ^~~
museum.cpp:7:33: error: expected primary-expression before 'int'
 void score(map<string, int>& m, int i, int j) {
                                 ^~~
museum.cpp:7:40: error: expected primary-expression before 'int'
 void score(map<string, int>& m, int i, int j) {
                                        ^~~
museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:18:2: error: 'map' was not declared in this scope
  map<string, int> m;
  ^~~
museum.cpp:18:2: note: suggested alternative:
In file included from /usr/include/c++/7/map:61:0,
                 from museum.cpp:5:
/usr/include/c++/7/bits/stl_map.h:99:11: note:   'std::map'
     class map
           ^~~
museum.cpp:18:6: error: 'string' was not declared in this scope
  map<string, int> m;
      ^~~~~~
museum.cpp:18:6: note: suggested alternatives:
In file included from /usr/include/c++/7/string:39:0,
                 from museum.cpp:3:
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
museum.cpp:18:14: error: expected primary-expression before 'int'
  map<string, int> m;
              ^~~
museum.cpp:29:11: error: expected ';' before 's'
    string s;
           ^
museum.cpp:31:11: error: 'm' was not declared in this scope
     score(m, i, j);
           ^
museum.cpp:31:5: error: 'score' was not declared in this scope
     score(m, i, j);
     ^~~~~
museum.cpp:31:5: note: suggested alternative: 'short'
     score(m, i, j);
     ^~~~~
     short
museum.cpp:36:11: error: 'm' was not declared in this scope
     score(m, i, j);
           ^
museum.cpp:36:5: error: 'score' was not declared in this scope
     score(m, i, j);
     ^~~~~
museum.cpp:36:5: note: suggested alternative: 'short'
     score(m, i, j);
     ^~~~~
     short
museum.cpp:42:11: error: 'm' was not declared in this scope
     score(m, i, j);
           ^
museum.cpp:42:5: error: 'score' was not declared in this scope
     score(m, i, j);
     ^~~~~
museum.cpp:42:5: note: suggested alternative: 'short'
     score(m, i, j);
     ^~~~~
     short
museum.cpp:48:9: error: 'm' was not declared in this scope
  return m.size();
         ^