답안 #1099855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099855 2024-10-12T05:37:36 Z model_code 상형문자열 (IOI24_hieroglyphs) C++17
13 / 100
22 ms 2632 KB
// incorrect/yiping-bin.cpp

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

bool is_subseq(const vector<int> &a, const vector<int> &c)
{
	int j = 0;
	for(int i=0; i<(int)a.size() && j<(int)c.size(); ++i)
		if(a[i] == c[j]) ++j;
	return j >= (int)c.size();
}

bool is_single(const vector<int> &a,int l,int r)
{
	for(int i=l; i<(int)a.size()-r; ++i)
		if(a[i] != a[l]) return 0;
	return 1;
}

vector<int> ucs(vector<int> a, vector<int> b)
{
	if(is_subseq(a,b)) return b;
	if(is_subseq(b,a)) return a;
	
	int l = 0, r = 0;
	vector<int> pre, suf;
	while(a[l] == b[l]) ++l;
	while(a[(int)a.size()-r-1] == b[(int)b.size()-r-1]) ++r;
	
	if(is_single(b,l,r)) swap(a,b);
	if(!is_single(a,l,r)) return {-1};
	
	vector<int> c(a.begin(), a.begin() + l);
	c.insert(c.end(), count(b.begin() + l, b.end() - r, a[l]), a[l]);
	c.insert(c.end(), a.end() - r, a.end());
	
	return c;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 22 ms 2112 KB Output is correct
6 Correct 16 ms 1884 KB Output is correct
7 Correct 12 ms 2004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 22 ms 2112 KB Output is correct
6 Correct 16 ms 1884 KB Output is correct
7 Correct 12 ms 2004 KB Output is correct
8 Incorrect 16 ms 1660 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 1996 KB Output is correct
2 Correct 19 ms 1992 KB Output is correct
3 Correct 18 ms 2260 KB Output is correct
4 Correct 14 ms 2136 KB Output is correct
5 Correct 17 ms 1692 KB Output is correct
6 Correct 7 ms 1116 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 17 ms 2632 KB Output is correct
17 Correct 12 ms 1884 KB Output is correct
18 Correct 20 ms 1796 KB Output is correct
19 Correct 8 ms 1372 KB Output is correct
20 Correct 15 ms 2140 KB Output is correct
21 Correct 11 ms 1628 KB Output is correct
22 Correct 11 ms 1992 KB Output is correct
23 Correct 9 ms 1996 KB Output is correct
24 Correct 9 ms 1992 KB Output is correct
25 Correct 10 ms 2000 KB Output is correct
26 Correct 10 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 1660 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Incorrect 1 ms 348 KB Output isn't correct
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -