QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449206#4826. Find the Partsrizynvu0 43ms222604kbC++142.6kb2024-06-20 20:05:082024-06-20 20:05:09

Judging History

你现在查看的是最新测评结果

  • [2024-06-20 20:05:09]
  • 评测
  • 测评结果:0
  • 用时:43ms
  • 内存:222604kb
  • [2024-06-20 20:05:08]
  • 提交

answer

#include<bits/stdc++.h>
namespace First {
   inline char to16(int x) {
      return x < 10 ? (x + '0') : (x - 10 + 'A');
   }
   inline std::string to256(int x) {
      return std::string("") + to16(x / 16) + to16(x % 16);
   }
   inline void main() {
      int n, m;
      std::cin >> n >> m;
      std::vector<std::string> ans;
      ans.push_back(to256(m / 256)), ans.push_back(to256(m % 256));
      for (int i = 0; i < n; i++)
         for (int j = 1; j <= m; j++) {
            std::string s;
            std::cin >> s;
            if (i % 10 == 0) ans.push_back(s);
         }
      std::cout << ans.size() << '\n';
      for (auto x : ans) std::cout << x << ' ';
   }
}
namespace Second {
   inline int to16(char x) {
      return x >= 'A' ? (x - 'A' + 10) : (x - '0');
   }
   inline int to256(std::string x) {
      return to16(x[0]) * 16 + to16(x[1]);
   }
   const int maxn = 2000 * 200 * 10 + 10;
   std::unordered_map<int, int> son[maxn];
   inline void main() {
      int len; std::cin >> len;
      std::vector<std::string> S(len);
      for (auto &x : S) std::cin >> x;
      int m = to256(S[0]) * 256 + to256(S[1]);
      int tot = 0;
      for (int i = 2, h = 1; i < S.size(); i += m, h += 10) {
         for (int j = i; j < i + m; j++)
            std::cout << S[j] << ' ';
         std::cout << '\n';
         for (int j = i; j + 10 <= i + m; j++) {
            int now = 0;
            for (int k = j; k < j + 10; k++) {
               std::cout << to256(S[k]) << ' ';
               if (! son[now][to256(S[k])]) son[now][to256(S[k])] = ++tot;
               now = son[now][to256(S[k])];
            }
            std::cout << h << ' ' << j - i + 1 << ' ' << now << '\n';
            son[now][0] = h, son[now][1] = j - i + 1;
         }
      }
      int Q; std::cin >> Q;
      while (Q--) {
         int h, w; std::cin >> h >> w;
         int ansx = -1, ansy = -1;
         for (int i = 0; i < h; i++) {
            std::vector<std::string> T(w);
            for (auto &x : T) std::cin >> x;
            int now = 0;
            for (int j = 0; j < 10; j++) {
               if (! son[now].count(to256(T[j]))) {now = 0; break;}
               else now = son[now][to256(T[j])];
            }
            if (now) ansx = son[now][0] - i, ansy = son[now][1];
         }
         std::cout << ansx << ' ' << ansy << '\n';
      }
   }
}
int main() {
   std::ios::sync_with_stdio(false);
   std::cin.tie(0), std::cout.tie(0);
   std::string s; std::cin >> s;
   s == "message" ? First::main() : Second::main();
   return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 43ms
memory: 222604kb

input:

message
20 24
33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81
86 3E 23 7B C9 38 77 82 7D 62 EA CE A8 DE 85 6C 36 B3 10 EE 85 6A D5 92
14 BD 58 74 20 7B 36 E1 89 B8 6F 4A F4 8F 17 2E 2F 0F 79 DD AA 9F 6F AD
85 21 B6 2F 58 37 87 7B 3F EE D9 7D 9A E6 AA 12 E0 B6 BB 3D 72 BD 34 A...

output:

50
00 18 33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81 EC C9 BE 91 3B DF 1C DC 61 5C 66 1C B3 26 1C 2E 11 0D 19 BD DC 08 1A 90 

input:

parts
50
00 18 33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81 EC C9 BE 91 3B DF 1C DC 61 5C 66 1C B3 26 1C 2E 11 0D 19 BD DC 08 1A 90
2
10 10
39 73 4A 5A AA E0 86 96 4B 0B
3E 23 7B C9 38 77 82 7D 62 EA
BD 58 74 20 7B 36 E1 89 B8 6F
21 B6 2F 58 37 87 7B 3F EE D9
8A 73 EE 69 B...

output:

33 39 73 4A 5A AA E0 86 96 4B 0B 83 A0 FA 82 9B B0 6E DC 03 1C B9 5B 81 
51 57 115 74 90 170 224 134 150 75 1 1 10
57 115 74 90 170 224 134 150 75 11 1 2 20
115 74 90 170 224 134 150 75 11 131 1 3 30
74 90 170 224 134 150 75 11 131 160 1 4 40
90 170 224 134 150 75 11 131 160 250 1 5 50
170 224 134 1...

result:

wrong answer wrong answer on query 1: read (33, 39) but expected (1, 2)