QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#326053#5680. You You See What?cryWA 1ms3600kbC++202.5kb2024-02-12 08:56:502024-02-12 08:56:50

Judging History

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

  • [2024-02-12 08:56:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2024-02-12 08:56:50]
  • 提交

answer

#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#ifndef LOCAL
#define debug(...) 0
#else
#include "C:\programmingfunnyxd\debug.cpp"
#endif
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFLL = 1e18;
 
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define FORE(i,a,b) for(int i = (a); i <= (b); ++i)
#define ROF(i,a,b) for(int i = (a); i >= (b); --i)
#define trav(a,x) for(auto& a: x)
#define sz(x) (int)x.size()
#define make_unique(v) sort(all(v)); v.erase(unique(all(v)), v.end())

template<class T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<class T> bool ckmin(T& a, const T& b){return b<a?a=b,1:0;}
template<class T> bool ckmax(T& a, const T& b){return a<b?a=b,1:0;}
template<int D, typename T>struct vt : public vector<vt<D - 1, T>> { template<typename... Args>
	vt(int n = 0, Args... args) : vector<vt<D - 1, T>>(n, vt<D - 1, T>(args...)) {}};
template<typename T> struct vt<1, T> : public vector<T> {
	vt(int n = 0, const T& val = T()) : vector<T>(n, val) {}};
template<typename T> istream& operator>>(istream& in, vector<T>& a) {for(auto &x : a) in >> x; return in;};
template<typename T> ostream& operator<<(ostream& out, vector<T>& a) {for(auto &x : a) out << x << ' '; return out;};


template<typename T>
vector<string> split(T str, char sep){
	vector<string> output;
	size_t start = 0, end = 0;
	while((end = str.find(sep,start)) != string::npos){
		if(end != start)output.push_back(str.substr(start,end-start));
		start = end+1;
	}
	
	if(end != start)output.push_back(str.substr(start));
	return output;
	
}

string to_lower(string& s){
	string bruh;
	trav(c, s) bruh.pb(tolower(c));
	return bruh;
}

void solve() {
	string s; cin >> s;
	vector<string> v = split(s, '!');
	map<string, int> last_occ;
	int n = sz(v);
	FOR(i,0,n) last_occ[to_lower(v[i])] = i;
	vector<string> res;
	FOR(i,0,n){
		res.pb(v[i]);
		string low = to_lower(v[i]);
		// if(i < n - 1 && last_occ[to_lower(v[i + 1])] != i + 1) continue;
		if(last_occ.count(low)){
			i = last_occ[low];
		}
	}
	FOR(i,0,sz(res)){
		cout << res[i] << (i == sz(res) - 1 ? "" : "!");
	}
}

signed main() {
	cin.tie(0) -> sync_with_stdio(0);
	int t = 1;
	//cin >> t;
	for(int test = 1; test <= t; test++){
		solve();
	}
}

/*   /\_/\
*   (= ._.)
*   / >  \>
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3600kb

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: -100
Wrong Answer
time: 0ms
memory: 3504kb

input:

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

output:

texasam!Rice!bresearch!bpoucher

result:

wrong answer 1st lines differ - expected: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher', found: 'texasam!Rice!bresearch!bpoucher'