QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#553410#9239. Hieroglyphsthomaswmy#0 51ms18084kbC++142.0kb2024-09-08 12:56:512024-09-08 12:56:51

Judging History

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

  • [2024-09-08 12:56:51]
  • 评测
  • 测评结果:0
  • 用时:51ms
  • 内存:18084kb
  • [2024-09-08 12:56:51]
  • 提交

answer

#include <bits/stdc++.h>
#include "hieroglyphs.h"
using namespace std;
const int N=2e5+10;

int n,m;
vector<int> psa[N],psb[N];

struct BIT{
  int t[N];

  int lowbit(int x) {
    return x&-x;
  }

  void change(int pos,int val) {
    pos++;
    for(;pos<N;pos+=lowbit(pos)) t[pos]+=val;
  }

  int sum(int pos) {
    pos++;
    int res=0;
    for(;pos;pos-=lowbit(pos)) res+=t[pos];
    return res;
  }

  int query(int l,int r) {
    return sum(r)-sum(l-1);
  }
}bit;

vector<int> ucs(vector<int> A,vector<int> B) {
  n=A.size(),m=B.size();
  vector<int> res;
  for(int i=0;i<n;i++) psa[A[i]].push_back(i);
  for(int i=0;i<m;i++) psb[B[i]].push_back(i);
  int l=0,r=0;
  while(l<n && r<m) {
    if(A[l]==B[r]) {
      res.push_back(A[l]);
      l++,r++;
      continue;
    }
    int cntla=0,cntlb=0;
    for(int i:psa[A[l]]) if(i>=l) cntla++;
    for(int i:psb[A[l]]) if(i>=r) cntlb++;
    int cntra=0,cntrb=0;
    for(int i:psa[B[r]]) if(i>=l) cntra++;
    for(int i:psb[B[r]]) if(i>=r) cntrb++;
    if(cntlb==0) {
      l++;
      continue;
    }
    if(cntla==1) {
      res.push_back(A[l]);
      for(int i:psb[A[l]]) if(i>=r) r=i+1;
      l++;
      continue;
    }
    if(cntra==0) {
      r++;
      continue;
    }
    if(cntrb==1) {
      res.push_back(B[r]);
      for(int i:psa[B[r]]) if(i>=l) l=i+1;
      r++;
      continue;
    }
    if(psb[A[l]][0]<=psb[B[r]][1]) {
      r++;
      continue;
    }
    else {
      l++;
      continue;
    }
  }
  return res;
  int cnt=0;
  for(int i=0;i<=2e5;i++) if(psa[i].size() && psb[i].size()) cnt++;
  for(int i=0;i<n;i++) {
    if(psa[A[i]].size()+psb[A[i]].size()==3) {
      if(psa[A[i]].size() && psb[A[i]].size()) {
        if(psa[A[i]].size()==1) {
          if(bit.query(psb[A[i]][0],psb[A[i]][1])) return {-1};
        }
        else {
          if(i==psa[A[i]][0]) bit.change(psb[A[i]][0],1);
          else bit.change(psb[A[i]][0],-1);
        }
      }
    }
  }
  if(res.size()!=cnt) return {-1};
  return res;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 3
Accepted
time: 3ms
memory: 13176kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
10 10
7 1 9 2 3 5 0 6 8 4
7 1 9 2 3 5 0 6 8 4

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
10
7 1 9 2 3 5 0 6 8 4

result:

ok 

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 13148kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
10 10
7 9 4 5 6 8 2 1 3 0
7 9 4 5 8 6 2 1 3 0

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
9
7 9 4 5 6 2 1 3 0

result:

wrong answer 3rd lines differ - on the 1st token, expected: '1', found: '9'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 23ms
memory: 17724kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
89984 90016
167910 187180 47437 150113 199404 61979 49501 155514 167910 175137 104441 149717 155514 13573 170025 181983 117868 13573 149717 166954 145922 29787 93788 58581 158693 51768 120499 17700 17700 4746 119328 33450 138501 137246 33450 135751 84363 168724 15701...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
45
187180 47437 150113 199404 61979 49501 167910 175137 104441 155514 170025 181983 117868 13573 149717 166954 145922 29787 93788 58581 158693 51768 120499 17700 4746 119328 138501 137246 33450 135751 84363 168724 157010 177276 46818 196174 156362 196963 13865 124...

result:

wrong answer 3rd lines differ - on the 1st token, expected: '60000', found: '45'

Subtask #3:

score: 0
Time Limit Exceeded

Test #71:

score: 0
Time Limit Exceeded

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
100000 100000
0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0...

output:


result:


Subtask #4:

score: 0
Wrong Answer

Test #97:

score: 16
Accepted
time: 23ms
memory: 14184kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
20000 30000
110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
20000
110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955 110955...

result:

ok 

Test #98:

score: 16
Accepted
time: 51ms
memory: 15608kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
99999 88888
22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 224...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
88886
22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 22478 ...

result:

ok 

Test #99:

score: 16
Accepted
time: 22ms
memory: 16112kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
100000 100000
166304 166304 166304 166304 166304 166304 166304 166304 102708 11497 11497 11497 11497 11497 11497 11497 11497 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 125776 125776 125776 125776 125776 125776 125776 125...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
85709
166304 166304 166304 166304 166304 166304 166304 102708 11497 11497 11497 11497 11497 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 17510 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 125776 12...

result:

ok 

Test #100:

score: 16
Accepted
time: 18ms
memory: 16300kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
100000 100000
117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 1...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
95801
117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117 117117...

result:

ok 

Test #101:

score: 16
Accepted
time: 30ms
memory: 15836kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
100000 100000
127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 1...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
98803
127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501 127501...

result:

ok 

Test #102:

score: 16
Accepted
time: 32ms
memory: 16044kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
100000 100000
116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 1...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
99078
116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473 116473...

result:

ok 

Test #103:

score: 0
Wrong Answer
time: 28ms
memory: 18084kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
90001 89999
171539 66534 9757 176662 84211 83487 129394 86197 172362 142984 93418 146577 96159 191701 83516 196081 37110 105351 165140 54539 124569 187177 24718 194979 119131 15727 40820 31718 13095 147840 76889 199389 75862 118045 115442 10325 157261 11275 83362 174...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
22289
66534 9757 176662 84211 83487 129394 142984 93418 146577 83516 196081 37110 105351 165140 124569 187177 24718 194979 119131 15727 40820 31718 13095 147840 199389 75862 118045 115442 10325 157261 65924 116867 79792 176399 72785 44440 157912 59340 190183 13759...

result:

wrong answer 3rd lines differ - on the 1st token, expected: '69029', found: '22289'

Subtask #5:

score: 0
Wrong Answer

Test #132:

score: 0
Wrong Answer
time: 3ms
memory: 13300kb

input:

vHwzrZUx9chlYIJ7zODvOcQbZwj3OxhB
2800 2999
47 51 42 122 38 125 170 11 119 48 289 297 27 150 207 271 11 15 67 287 149 220 76 274 128 151 60 117 39 123 254 75 170 198 72 179 274 203 13 88 139 153 46 288 13 282 16 219 284 91 274 63 190 157 72 286 238 1 219 82 82 31 285 128 198 172 161 271 36 111 160 26...

output:

IyRwUZ9rsuq5tjuK54lpSvORqGQyBWEZ
OK
1989
47 51 42 122 38 125 170 11 119 48 289 297 27 150 207 271 11 15 67 287 149 220 76 274 128 151 60 117 39 123 254 75 170 198 72 179 274 203 13 88 139 153 46 288 13 282 16 219 284 91 274 63 190 157 72 286 238 1 219 82 82 31 285 128 198 172 161 271 36 111 160 268 ...

result:

wrong answer 3rd lines differ - on the 1st token, expected: '2800', found: '1989'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%