This commit is contained in:
Zengtudor 2025-07-21 09:18:21 +08:00
parent 7cdbbfba00
commit bd96024050
10 changed files with 800094 additions and 3 deletions

View File

@ -1,11 +1,70 @@
#include <algorithm>
#include <cstdint>
#include <iostream> #include <iostream>
#include <istream> #include <istream>
#include <vector>
using ll = int64_t;
ll n;
bool isCase2=true;
struct V{
ll a,b,c;
};
std::vector<V> v;
template<class ...Ts>
void log(Ts&&...ts){
// std::cout<<"Log: ";
// ((std::cout<<ts<<' '),...);
// std::cout<<'\n';
}
namespace c1 {
std::vector<ll> nmax;
void dfs(ll now,ll div1n,ll div2n){
nmax[now-1]=std::max(nmax[now-1],std::min(div1n,div2n));
if(now>n)return;
for(ll div1=std::min(v[now].a,v[now].b);div1>=0;div1--){
ll div2=std::min(v[now].b-div1,v[now].c);
log("now:",now,"div1:",div1,"div2:",div2);
dfs(now+1,div1n+div1,div2n+div2);
}
}
}
int main(){ int main(){
std::iostream::sync_with_stdio(false); std::iostream::sync_with_stdio(false);
std::cin.tie(nullptr); std::cin.tie(nullptr);
std::cout.tie(nullptr); std::cout.tie(nullptr);
std::cin>>n;
v.resize(n+1);
for(ll i=1;i<=n;i++){
std::cin>>v[i].a>>v[i].b>>v[i].c;
if(v[i].a+v[i].c>v[i].b){
isCase2=false;
}
}
if(isCase2){
ll as{},cs{};
for(ll i=1;i<=n;i++){
as+=v[i].a;
cs+=v[i].c;
std::cout<<std::min(as,cs)<<'\n';
}
return 0;
}
// isCase1
{
using namespace c1;
nmax.resize(n+1);
dfs(1, 0, 0);
for(ll i=1;i<=n;i++){
std::cout<<nmax[i]<<'\n';
}
}
} }
/* /*
@ -19,7 +78,10 @@ output
6 6
7 7
5 7 5 -> (5,2),(4,3),(3,4),(2,5),(min(a,b)~b/2,b-div1) 5 7 5 -> (5,2),(4,3),(3,4),(2,5)
1 8 8 -> (1,7), 1 8 8 -> (1,7),(0,8)
3 1 2 -> (1,0),(0,1) 3 1 2 -> (1,0),(0,1)
*/ */

3
src/7/21/T636328.cpp Normal file
View File

@ -0,0 +1,3 @@
int main(){
}

3
src/7/21/contest1.ans Normal file
View File

@ -0,0 +1,3 @@
3
6
7

4
src/7/21/contest1.in Normal file
View File

@ -0,0 +1,4 @@
3
5 7 5
1 8 8
3 1 2

8
src/7/21/contest2.ans Normal file
View File

@ -0,0 +1,8 @@
3
5
7
8
9
12
13
15

9
src/7/21/contest2.in Normal file
View File

@ -0,0 +1,9 @@
8
8 6 6
8 5 4
8 4 7
7 1 3
6 3 8
5 5 5
2 2 1
7 5 1

200000
src/7/21/contest3.ans Normal file

File diff suppressed because it is too large Load Diff

200001
src/7/21/contest3.in Normal file

File diff suppressed because it is too large Load Diff

200000
src/7/21/contest4.ans Normal file

File diff suppressed because it is too large Load Diff

200001
src/7/21/contest4.in Normal file

File diff suppressed because it is too large Load Diff