QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#674097 | #7187. Hardcore String Counting | Rezhou# | WA | 1ms | 3688kb | C++23 | 3.1kb | 2024-10-25 13:50:29 | 2024-10-25 13:50:30 |
Judging History
answer
#include <bits/stdc++.h>
#define x first
#define y second
#define int long long
#define double long double
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pair<int, int>> pip;
typedef const double* (*p_fun)(const double*, int);
const LL N = 2e5 + 10, M = 2e3 + 10, mod = 1e9 + 7, LLF = 1e15,
null = 0x3f3f3f3f3f3f3f;
template <typename T>
bool chmax(T& a, const T& b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <typename T, typename... Args>
bool chmax(T& a, const T& b, const Args &...args) {
bool updated = chmax(a, b);
return chmax(a, args...) || updated;
}
template <typename T>
bool chmin(T& a, const T& b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename T, typename... Args>
bool chmin(T& a, const T& b, const Args &...args) {
bool updated = chmin(a, b);
return chmin(a, args...) || updated;
}
class UnionFind {
public:
vector<int> parent;
vector<int> size;
int n;
// 当前连通分量数目
int setCount;
public:
UnionFind(int _n) : n(_n), setCount(_n), parent(_n), size(_n, 1) {
iota(parent.begin(), parent.end(), 0);
}
int find(int x) { return parent[x] == x ? x : parent[x] = find(parent[x]); }
bool merge(int x, int y) {
x = find(x);
y = find(y);
if (x == y) return false;
if (size[x] < size[y]) swap(x, y);
parent[y] = x;
size[x] += size[y];
--setCount;
return true;
}
bool connected(int x, int y) {
x = find(x);
y = find(y);
return x == y;
}
};
int qmi(int a, int b) {
int res = 1;
a %= mod;
while (b) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
int sqrt(int x) {
int l = 0, r = 3e9; // LLONG_MAX
while (l < r) {
int mid = (l + r + 1) >> 1;
if (mid * mid > x)
r = mid - 1; // 向下取整
else
l = mid;
}
return r;
}
int f[N][2];
int n, c, a[N];
vector<int> v[N];
void dfs(int u, int fa) {
f[u][1] = a[u];
for (auto& it : v[u]) {
if (it == fa) continue;
dfs(it, u);
f[u][0] += max(f[it][0], f[it][1]);
f[u][1] += max(f[it][0], f[it][1] - 2 * c);
}
}
static inline void solve() {
int n;
cin >> n;
int ans = 0;
/*if (n & 1) ans = (n + 1) / 2 / 3 + n / 2 / 3 + (n / 2 % 3 != 0) + ((n + 1) / 2 % 3 != 0);
else ans = n / 2 / 3 + n / 2 / 3 + (n / 2 % 3 != 0) * 2;*/
for (int i = ((n + 1) / 2) - 3; i >= 1; i -= 3) ans++;
for (int i = ((n + 1) / 2) + (n % 2 == 0) + 3; i <= n; i += 3) ans++;
ans++;
if (n % 2 == 0) ans++;
cout << ans << ' ' << n << endl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cout << unitbuf;
int t = 1;
//cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3688kb
input:
6 7 aaaaaa
output:
2 6
result:
wrong answer expected '25', found '2'