Compare commits

...
10 Commits
Author SHA1 Message Date
hanyixuanten eb7a278b1b new file: 0x10/3.cpp 2026-08-24 20:06:11 +08:00
hanyixuanten daa97afaae new file: 0x10/2.cpp 2026-08-24 19:43:48 +08:00
hanyixuanten 124a3e999e new file: 0x10/1.cpp 2026-08-24 19:24:58 +08:00
hanyixuanten f025899392 new file: token.cpp 2026-08-24 19:24:03 +08:00
hanyixuanten ac8093b43e move 2026-08-24 19:22:22 +08:00
hanyixuanten 785c9dcea8 modified: 30.cpp 2026-08-18 11:39:05 +08:00
hanyixuanten 1f71aab9ff add space 2026-08-18 11:19:41 +08:00
hanyixuanten 3d6265ac1c new file: 43.cpp 2026-08-18 11:18:50 +08:00
hanyixuanten 58c77f67e8 new file: 42.cpp 2026-08-18 10:47:17 +08:00
hanyixuanten 51224a7941 Revert "testpush"
This reverts commit ff723f978a.
2026-08-18 10:46:15 +08:00
49 changed files with 243 additions and 1 deletions
+2 -1
View File
@@ -4,4 +4,5 @@
!.vscode/
!.vscode/*
!ac-congrats.png
!README.md
!README.md
!0x*
View File
View File
View File
+1
View File
@@ -0,0 +1 @@
// 98
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+46
View File
@@ -0,0 +1,46 @@
// 115 not finished
#include <bits/stdc++.h>
using namespace std;
int n;
int a[1005];
int fa[1005];
int dt[1005];
int root;
vector<int> chi[1005];
bool ran[1005];
int ans, T;
void dfs(int now) // 染色到dt[now]
{
if (dt[now] == root)
{
ran[now] = 1, ans += (T++) * a[dt[now]];
return;
}
if (!ran[fa[dt[now]]])
dfs(fa[dt[now]]);
ran[now] = 1, ans += (T++) * a[dt[now]];
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]), dt[i] = i;
sort(dt + 1, dt + n + 1, [](int x, int y)
{ return a[x] < a[y]; });
for (int u, v, i = 1; i < n; ++i)
scanf("%d%d", &u, &v),
fa[v] = u, chi[u].push_back(v);
for (int i = 1; i <= n; ++i)
{
if (fa[i] == i)
{
root = i;
break;
}
}
for (int i = 1; i <= n; ++i)
{
dfs(i);
}
printf("%d\n", ans);
}
View File
View File
View File
+1
View File
@@ -0,0 +1 @@
// 119
View File
View File
View File
View File
View File
View File
View File
View File
+24
View File
@@ -0,0 +1,24 @@
// 126
#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[105][105], sum[105][105];
int query(int xx1, int yy1, int xx2, int yy2)
{
return sum[xx2][yy2] - sum[xx1 - 1][yy2] - sum[xx2][yy1 - 1] + sum[xx1 - 1][yy1 - 1];
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
scanf("%d", &a[i][j]), sum[i][j] = a[i][j] + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
int ans = -2147482648;
for (int xx1 = 1; xx1 <= n; ++xx1)
for (int yy1 = 1; yy1 <= n; ++yy1)
for (int xx2 = xx1; xx2 <= n; ++xx2)
for (int yy2 = yy1; yy2 <= n; ++yy2)
if (query(xx1, yy1, xx2, yy2) > ans)
ans = query(xx1, yy1, xx2, yy2);
printf("%d", ans);
return 0;
}
+34
View File
@@ -0,0 +1,34 @@
// 127
#include <bits/stdc++.h>
using namespace std;
int n, m;
pair<int, int> rob[100005], task[100005];
int c[105];
int main()
{
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i)
scanf("%d%d", &rob[i].first, &rob[i].second);
for (int i = 1; i <= m; ++i)
scanf("%d%d", &task[i].first, &task[i].second);
sort(rob + 1, rob + n + 1, [](pair<int, int> a, pair<int, int> b)
{ return (a.first == b.first) ? a.second > b.second : a.first > b.first; });
sort(task + 1, task + m + 1, [](pair<int, int> a, pair<int, int> b)
{ return (a.first == b.first) ? a.second > b.second : a.first > b.first; });
int p = 0;
int cnt = 0;
long long ans = 0;
for (int i = 1; i <= m; ++i)
{
while (p < n && rob[p + 1].first >= task[i].first)
p++, c[rob[p].second]++;
for (int j = task[i].second; j <= 100; j++)
if (c[j])
{
cnt++, c[j]--, ans += task[i].first * 500 + task[i].second * 2;
break;
}
}
printf("%d %lld\n", cnt, ans);
return 0;
}
View File
View File
View File
View File
View File
+38
View File
@@ -0,0 +1,38 @@
// 41
class MinStack
{
public:
/** initialize your data structure here. */
int a[105], tot = 0;
MinStack()
{
}
void push(int x)
{
a[++tot] = x;
}
void pop()
{
tot--;
}
int top()
{
return a[tot];
}
int getMin()
{
int ans = 1e9;
for (int i = tot; i >= 1; i--)
ans = (a[i] < ans) ? a[i] : ans;
return ans;
}
};
/**
* Your MinStack object will be instantiated and called as such:
* MinStack obj = new MinStack();
* obj.push(x);
* obj.pop();
* int param_3 = obj.top();
* int param_4 = obj.getMin();
*/
+56
View File
@@ -0,0 +1,56 @@
// 128
#include <bits/stdc++.h>
using namespace std;
int q;
int qjh[1000005];
int ans[1000005];
vector<int> s, tmp;
int main()
{
cin >> q;
for (int i = 0; i <= q + 1; ++i)
ans[i] = INT_MIN;
while (q--)
{
char c;
cin >> c;
if (c == 'I')
{
int x;
cin >> x;
s.push_back(x);
qjh[s.size()] = qjh[s.size() - 1] + x;
ans[s.size()] = max(ans[s.size() - 1], qjh[s.size()]);
}
else if (c == 'D')
{
if (!s.empty())
s.pop_back();
}
else if (c == 'L')
{
if (!s.empty())
{
tmp.push_back(s[s.size() - 1]);
s.pop_back();
}
}
else if (c == 'R')
{
if (!tmp.empty())
{
s.push_back(tmp[tmp.size() - 1]);
qjh[s.size()] = qjh[s.size() - 1] + tmp[tmp.size() - 1];
ans[s.size()] = max(ans[s.size() - 1], qjh[s.size()]);
tmp.pop_back();
}
}
else
{
int x;
cin >> x;
cout << ans[x] << endl;
}
}
return 0;
}
+37
View File
@@ -0,0 +1,37 @@
// 129
#include <bits/stdc++.h>
using namespace std;
vector<int> ans;
int stk[25], tot, n, cnt;
void dfs(int now)
{
if (cnt >= 20)
return;
if (now > n)
{
cnt++;
for (auto x : ans)
cout << x;
for (int i = tot - 1; i >= 0; i--)
cout << stk[i];
puts("");
return;
}
if (tot)
{
ans.push_back(stk[--tot]);
dfs(now);
stk[tot++] = ans.back();
ans.pop_back();
}
stk[tot++] = now;
dfs(now + 1);
tot--;
}
int main()
{
cin >> n;
dfs(1);
return 0;
}
View File
+4
View File
@@ -0,0 +1,4 @@
/*
pub3
pgs_26889668c3e1ed69f39ea7ec9c055a4a724cddb8814ce55b52c72e4dcdb57679
*/