0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 21:38:47 +00:00

Compare commits

..

4 Commits

63 changed files with 306 additions and 3 deletions

1
.gitattributes vendored
View File

@ -9,3 +9,4 @@
*.gz filter=lfs diff=lfs merge=lfs -text
**/data/**/* filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
**/sample/**/* filter=lfs diff=lfs merge=lfs -text

6
.gitignore vendored
View File

@ -34,8 +34,10 @@
*.app
# Data
!*/data/*
!**/data/*
!**/data/**/*
# Sample
!**/sample/**/*
# tempCodeRunnerFile
temp/**

65
LibreOJ/3737/3737.cpp Normal file
View File

@ -0,0 +1,65 @@
#include <iostream>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
const char endl = '\n';
const int mod = 1e9 + 7;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
long long ans = 1;
cin >> n;
std::vector<std::pair<int, int>> data(n);
for (auto &item : data) {
cin >> item.first;
}
for (auto &item : data) {
cin >> item.second;
}
for (auto &item : data) {
if (item.first == 1) {
ans = (ans + item.second) % mod;
item.first = -1;
}
}
long double max = ans;
auto max_it = data.end();
for (auto it = data.begin(); it != data.end(); it++) {
if (it->first == -1) continue;
long double t = static_cast<long double>(ans + it->second) / it->first;
if (t > max) {
max = t;
max_it = it;
}
}
if (max_it != data.end()) {
ans += max_it->second;
max_it->first = -1;
}
for (const auto &item : data) {
if (~item.first) {
ans = (ans * item.first) % mod;
}
}
cout << ans << endl;
return 0;
}

BIN
LibreOJ/3737/data/food1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food11.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food12.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food13.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food14.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food15.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food16.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food17.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food18.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food19.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food20.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/data/food9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/3737/sample/food9.in (Stored with Git LFS) Normal file

Binary file not shown.

61
Luogu/P8365/P8365.cpp Normal file
View File

@ -0,0 +1,61 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5e5 + 5;
const int mod = 1e9 + 7;
int n, a[N], b[N], ans = 1;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
cin >> b[i];
}
for (int i = 1; i <= n; i++) {
if (a[i] == 1) {
ans = (static_cast<long long>(ans) + b[i]) % mod;
a[i] = -1;
}
}
long double max = ans;
int max_id = -1;
for (int i = 1; i <= n; i++) {
if (~a[i]) {
long double t = static_cast<long double>(static_cast<long long>(ans) + b[i]) / a[i];
if (t > max) {
max = t;
max_id = i;
}
}
}
if (~max_id) {
a[max_id] = -1;
ans = (static_cast<long long>(ans) + b[max_id]) % mod;
}
for (int i = 1; i <= n; i++) {
if (~a[i]) {
ans = static_cast<long long>(ans) * a[i] % mod;
}
}
cout << ans << endl;
return 0;
}

View File

@ -10,7 +10,7 @@
- 部分代码的思路借鉴了题解。
- 部分题目文件夹下会有 `solution.md` 给出做题思路,也会有部分题目会在 [博客](https://oi.baoshuo.ren/) 中给出题解。
- 部分题目的 `data` 文件夹下会存放该题的部分测试数据,这部分内容使用 Git LFS 存储,请参阅下方的「测试数据」一节。
- 部分题目的 `sample` 和 `data` 文件夹下会存放该题的部分大样例以及测试数据,该部分内容使用 Git LFS 存储,请参阅下方的「测试数据」一节。
做题时间请参考 `Author Date` ,或根据题目对应提交中注明的提交记录编号查找。