Submission #1313106

#TimeUsernameProblemLanguageResultExecution timeMemory
1313106eri16상형문자열 (IOI24_hieroglyphs)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "hieroglyphs.h" using namespace std; bool contains(const vector<int>& big, const vector<int>& small){ if (small.size()>big.size()) return false; int n=big.size(), m=small.size(); vector<int> lps(m, 0); for (int i=1, len=0; i<m;){ if (small[i]==small[len]){lps[i++]=++len;} else if (len!=0){len=lps[len-1];} else{lps[i++]=0;} } for (int i=0, j=0; i<n;){ if (big[i]==small[j]){ i++; j++; } if (j==m) return true; else if (i<n && big[i]!=small[j]){ if (j!=0) j=lps[j-1]; else i++; } } return false; } vector<int> ucs(vector<int> A, vector<int> B) { if (contains(A, B)) return B; if (contains(B, A)) return A; itn A0=0,A1=0,B0=0,B1=0; for (int i=0; i<A.size(); i++){if (A[i]==0){A0++;}else{A1++;}} for (int i=0; i<B.size(); i++){if (B[i]==0){B0++;}else{B1++;}} vector <int> ans; if (A0==0 || B0==0){ int lk = min(A1,B1); if (lk!=0){ for (int i=0 ; i<lk; i++){ ans.push_back(1); } return ans; } } if (A0==1 || B0==1){ int lk = min(A0,B0); if (lk!=0){ for (int i=0 ; i<lk; i++){ ans.push_back(0); } return ans; } } return {-1}; }

Compilation message (stderr)

hieroglyphs.cpp: In function 'std::vector<int> ucs(std::vector<int>, std::vector<int>)':
hieroglyphs.cpp:35:5: error: 'itn' was not declared in this scope; did you mean 'int'?
   35 |     itn A0=0,A1=0,B0=0,B1=0;
      |     ^~~
      |     int
hieroglyphs.cpp:37:49: error: 'A0' was not declared in this scope; did you mean 'A'?
   37 |     for (int i=0; i<A.size(); i++){if (A[i]==0){A0++;}else{A1++;}}
      |                                                 ^~
      |                                                 A
hieroglyphs.cpp:37:60: error: 'A1' was not declared in this scope; did you mean 'A'?
   37 |     for (int i=0; i<A.size(); i++){if (A[i]==0){A0++;}else{A1++;}}
      |                                                            ^~
      |                                                            A
hieroglyphs.cpp:38:49: error: 'B0' was not declared in this scope; did you mean 'B'?
   38 |     for (int i=0; i<B.size(); i++){if (B[i]==0){B0++;}else{B1++;}}
      |                                                 ^~
      |                                                 B
hieroglyphs.cpp:38:60: error: 'B1' was not declared in this scope; did you mean 'B'?
   38 |     for (int i=0; i<B.size(); i++){if (B[i]==0){B0++;}else{B1++;}}
      |                                                            ^~
      |                                                            B
hieroglyphs.cpp:42:9: error: 'A0' was not declared in this scope; did you mean 'A'?
   42 |     if (A0==0 || B0==0){
      |         ^~
      |         A
hieroglyphs.cpp:42:18: error: 'B0' was not declared in this scope; did you mean 'B'?
   42 |     if (A0==0 || B0==0){
      |                  ^~
      |                  B
hieroglyphs.cpp:43:22: error: 'A1' was not declared in this scope; did you mean 'A'?
   43 |         int lk = min(A1,B1);
      |                      ^~
      |                      A
hieroglyphs.cpp:43:25: error: 'B1' was not declared in this scope; did you mean 'B'?
   43 |         int lk = min(A1,B1);
      |                         ^~
      |                         B
hieroglyphs.cpp:51:9: error: 'A0' was not declared in this scope; did you mean 'A'?
   51 |     if (A0==1 || B0==1){
      |         ^~
      |         A
hieroglyphs.cpp:51:18: error: 'B0' was not declared in this scope; did you mean 'B'?
   51 |     if (A0==1 || B0==1){
      |                  ^~
      |                  B