QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#573791 | #7070. Isomerism | lazyx | AC ✓ | 22ms | 3568kb | C++20 | 3.3kb | 2024-09-18 20:00:12 | 2024-09-18 20:00:12 |
Judging History
answer
#include<bits/stdc++.h>
#include<array>
#define all(v) v.begin(),v.end()
//#pragma GCC optimize(3)
//#define __builtin_popcount __popcnt
using ll = long long;
using ull = unsigned long long;
using db = double;
using namespace std;
template<typename A>
A gcd(A a, A b) {
return b ? gcd(b, a % b) : a;
}
template<typename A>
A lcm(A a, A b) {
return a * b / gcd(a, b);
}
template<typename A>
bool isprime(A a) {
if (a == 1) {
return 0;
}
for (ll i = 2; i * i <= a; i++) {
if (a % i == 0) {
return false;
}
}
return true;
}
template<typename A>
A max(A a, A b, A c) {
return max(a, max(b, c));
}
template<typename A>
A min(A a, A b, A c) {
return min(a, min(b, c));
}
/*void que(int x, int y) {
cout << "? " << x << ' ' << y << '\n';
}
void ans(int x, int y) {
cout << "! " << x << ' ' << y << '\n';
}*/
const ll MOD = 998244353;
ll ksm(ll a, ll b, ll p) {
a %= p;
ll res = 1;
while (b) {
if (b & 1)res = res * a % p;
a = a * a % p;
b >>= 1;
}
return res;
}
vector<int>par;
int find(int x) {
return par[x] == x ? x : (par[x] = find(par[x]));
}
void merge(int x, int y) {
par[find(y)] = find(x);
}
/*
const int N = 1e7;
bool p[N + 5];
int pr[N + 5];
int sg[N + 10];
bool vis[N + 10];
int cnt = 0;
void Euler() {
memset(p, true, sizeof(p));
p[0] = p[1] = true; //特例
for (ll i = 2; i <= N; ++i) {
if (p[i]) pr[cnt] = i, sg[i] = ++cnt; //选出素数
for (int j = 0; j < cnt && pr[j] * i <= N; ++j) {
p[pr[j] * i] = false; //筛出非素数
if (i % pr[j] == 0) break; //重复筛选,跳出循环
}
}
}
auto mul = [](ll a, ll b) {
if (a == -1 || b == -1) return -1ll;
if (1e18 / b < a) return -1ll;
else return a * b;
};
const int N = 1e6;
ll fact[N + 10], in_fact[N + 10];
ll C(ll n, ll m) {
if (n < m || m < 0)return 0;
return fact[n] * in_fact[m] % MOD * in_fact[n - m] % MOD;
}
void init() {
fact[0] = 1;
in_fact[0] = 1;
for (int i = 1; i <= N; i++) {
fact[i] = fact[i - 1] * i % MOD;
in_fact[i] = ksm(fact[i], MOD - 2, MOD);
}
}
*/
int exgcd(ll a, ll b, ll& x, ll& y) {
if (!b) {
x = 1, y = 0;
return a;
}
ll d = exgcd(b, a % b, y, x);
y -= (a / b * x);
return d;
}
template<typename A>
A lowbit(A x) {
return x & (-x);
}
string ss[8] = { "-F","-Cl","-Br","-I","-CH3","-CH2CH3","-CH2CH2CH3","-H" };
void solve() {
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
if (s1 == s3 || s2 == s4)cout << "None\n";
else if (s1 == s2 || s3 == s4) cout << "Cis\n";
else if (s1 == s4 || s2 == s3)cout << "Trans\n";
else {
int id1 = 0;
while (ss[id1] != s1)id1++;
int id2 = 0;
while (ss[id2] != s2)id2++;
int id3 = 0;
while (ss[id3] != s3)id3++;
int id4 = 0;
while (ss[id4] != s4)id4++;
if ((id1 < id3 && id2 < id4)|| (id1 > id3 && id2 > id4))cout << "Zasamman\n";
else cout << "Entgegen\n";
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
2 -H -H -H -Cl -F -F -Br -Cl
output:
None Cis
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 22ms
memory: 3520kb
input:
100000 -Br -CH3 -H -CH2CH2CH3 -CH3 -I -Cl -Cl -CH3 -Br -CH2CH3 -CH3 -H -CH3 -Cl -CH3 -H -F -CH2CH3 -CH2CH2CH3 -Br -Br -Cl -CH2CH2CH3 -F -Cl -H -CH2CH2CH3 -CH2CH2CH3 -CH3 -CH3 -H -CH2CH2CH3 -CH3 -CH2CH2CH3 -Br -CH3 -Cl -CH2CH2CH3 -CH3 -H -CH2CH3 -I -I -CH3 -Cl -Br -I -I -Cl -H -F -CH2CH2CH3 -Cl -Br -...
output:
Zasamman Cis Trans None Entgegen Cis Zasamman Trans None Trans Cis Entgegen Entgegen Cis Cis Entgegen Trans None Cis None Cis None None Zasamman Cis None Entgegen Entgegen None None Cis Trans Zasamman Entgegen Zasamman Trans Entgegen None Zasamman Trans Cis Trans Zasamman Trans None Zasamman None Tr...
result:
ok 100000 lines