QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#714718#5680. You You See What?zeyu#WA 0ms3868kbC++233.0kb2024-11-06 03:42:042024-11-06 03:42:05

Judging History

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

  • [2024-11-06 03:42:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3868kb
  • [2024-11-06 03:42:04]
  • 提交

answer


#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define pl pair<ll, ll>
#define pi pair<int, int>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
using namespace std;

#if 1
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '['; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "]";}
void _print() {cerr << endl << flush;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "*["<<__LINE__<<"]\t"<< #x << " = "; _print(x)
#endif

const ll mod = 1e9 + 7;

template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;}
ll gcd(ll a, ll b) {if(b == 0){return a;} return gcd(b, a % b);}

char tolower(char c){
	if (c >= 'a' && c <= 'z') return c;
	else return c - 'A' + 'a';
}

bool same(string s1, string s2){
	if (s1.size() != s2.size()) return false;
	for (int i = 0; i < s1.size(); i ++){
		char c1 = tolower(s1[i]);
		char c2 = tolower(s2[i]);
		if (c1 != c2) return false;
	}
	return true;
}

vector<string> simp(vector<string> a){
	int n = a.size();
	for (int i = 0; i < n - 1; i ++){
		for (int j = i + 1; j < n; j ++){
			if (same(a[i], a[j]) && same(a[i + 1], a[j - 1])){
				vector<string> ans;
				for (int k = 0; k <= i; k ++) ans.push_back(a[k]);
				for (int k = j + 1; k < n; k ++) ans.push_back(a[k]);
				return ans;
			}
		}
	}
	for (int i = 0; i < n - 1; i ++){
		for (int j = i + 1; j < n - 1; j ++){
			if (same(a[i], a[j]) && same(a[i + 1], a[j + 1])){
				vector<string> ans;
				for (int k = 0; k <= i; k ++) ans.push_back(a[k]);
				for (int k = j + 2; k < n; k ++) ans.push_back(a[k]);
				return ans;
			}
		}
	}
	return a;
}
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s; cin >> s;
	int n = s.size();
	vector<string> a;
	int x = 0, len = 0;
	while(x < n){
		while(x + len < n && s[x + len] != '!') len ++;
		a.push_back(s.substr(x, len));
		x += len + 1; len = 0;
	}
	while(true){
		int orig = a.size();
		a = simp(a);
		if (a.size() == orig) break;
	}
	for (int i = 0; i < a.size() - 1; i ++) cout << a[i] << "!";
	cout << a.back();
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3868kb

input:

texasam!rice!baylor!csdept!baylor!rice!dev!bresearch!bpoucher

output:

texasam!rice!dev!bresearch!bpoucher

result:

ok single line: 'texasam!rice!dev!bresearch!bpoucher'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

texasam!Rice!baYlor!csdept!BayloR!dev!Rice!bresearch!bpoucher

output:

texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher

result:

ok single line: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

bresearch!bpoucher

output:

bresearch!bpoucher

result:

ok single line: 'bresearch!bpoucher'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3580kb

input:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x

output:

a!c!e!g!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x

result:

wrong answer 1st lines differ - expected: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x', found: 'a!c!e!g!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x'