0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 19:08:47 +00:00

Compare commits

..

No commits in common. "b294528f34d1ce65ad2f2d30e5a7642a616db201" and "552f6e3464c62b3c8624b48b051a63a06f1ca942" have entirely different histories.

7 changed files with 0 additions and 165 deletions

View File

@ -1,52 +0,0 @@
#include <iostream>
#include <stack>
using std::cin;
using std::cout;
const char endl = '\n';
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
std::stack<unsigned long long> st;
cin >> n;
while (n--) {
std::string op;
cin >> op;
if (op == "push") {
unsigned long long x;
cin >> x;
st.emplace(x);
} else if (op == "pop") {
if (st.empty()) {
cout << "Empty" << endl;
} else {
st.pop();
}
} else if (op == "query") {
if (st.empty()) {
cout << "Anguei!" << endl;
} else {
cout << st.top() << endl;
}
} else if (op == "size") {
cout << st.size() << endl;
}
}
}
return 0;
}

View File

@ -1,47 +0,0 @@
#include <iostream>
#include <cstring>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 105;
int n, m, f[N][N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
memset(f, 0x3f, sizeof(f));
for (int i = 1, u, v, w; i <= m; i++) {
cin >> u >> v >> w;
f[u][v] = f[v][u] = w;
}
for (int i = 1; i <= n; i++) {
f[i][i] = 0;
}
for (int k = 1; k <= n; k++) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
f[i][j] = std::min(f[i][j], f[i][k] + f[k][j]);
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout << f[i][j] << ' ';
}
cout << endl;
}
return 0;
}

View File

@ -1,54 +0,0 @@
#include <iostream>
#include <algorithm>
#include <functional>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5;
int n, m, a[N], b[N];
long long ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= m; i++) {
cin >> b[i];
}
std::sort(a + 1, a + 1 + n, std::greater<>());
std::sort(b + 1, b + 1 + m, std::greater<>());
int i = 1;
for (; i <= n && a[i] >= 0 && b[i] >= 0; i++) {
ans += static_cast<long long>(a[i]) * b[i];
}
std::sort(a + i, a + 1 + n);
std::sort(b + i, b + 1 + m);
for (; i <= n && a[i] < 0 && b[i] < 0; i++) {
ans += static_cast<long long>(a[i]) * b[i];
}
std::sort(a + i, a + 1 + n, std::greater<>());
std::sort(b + i, b + 1 + m, std::greater<>());
for (; i <= n; i++) {
ans += static_cast<long long>(a[i]) * b[i];
}
cout << ans << endl;
return 0;
}

BIN
NowCoder/contest/65194/A/samples/1.ans (Stored with Git LFS)

Binary file not shown.

BIN
NowCoder/contest/65194/A/samples/1.in (Stored with Git LFS)

Binary file not shown.

BIN
NowCoder/contest/65194/A/samples/2.ans (Stored with Git LFS)

Binary file not shown.

BIN
NowCoder/contest/65194/A/samples/2.in (Stored with Git LFS)

Binary file not shown.