Compare commits

..

No commits in common. "4b54a56f4f8ef295a34713a8b05fec29254e09e4" and "2f6d4e78c920cc2ad08207d309c55c2efcc1bd36" have entirely different histories.

2 changed files with 0 additions and 106 deletions

View File

@ -1,56 +0,0 @@
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll maxn{ll(1e5+5)}, mod{998244353};
ll n,a[maxn],m,t[maxn],p[maxn],v[maxn],q;
vector<ll> e[maxn];
void dfs(ll const &f){
if(t[f]==1){
a[p[f]]=(a[p[f]]+v[f])%mod;
}else if(t[f]==2){
for(ll j{1};j<=n;j++){
a[j]=(a[j]*v[f])%mod;
}
}else{
for(auto const&i:e[f]){
dfs(i);
}
}
}
int main(){
iostream::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n;
for(ll i{1};i<=n;i++){
cin>>a[i];
}
cin>>m;
for(ll i{1};i<=m;i++){
cin>>t[i];
if(t[i]==1){
cin>>p[i]>>v[i];
}else if(t[i]==2){
cin>>v[i];
}else{
ll c;
cin>>c;
while(c--){
ll f;
cin>>f;
e[i].emplace_back(f);
}
}
}
cin>>q;
for(ll i{1};i<=q;i++){
ll f;
cin>>f;
dfs(f);
}
for(ll i{1};i<=n;i++){
cout<<a[i]<<' ';
}
cout<<'\n';
}

View File

@ -1,50 +0,0 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using ll = int64_t;
ll t;
bool isfirst = true;
void solve(){
ll n;
std::cin>>n;
static std::vector<ll> a;
a.resize(n+1);
if(isfirst){
isfirst=false;
for(ll i=1;i<=n;i++){
std::cin>>a[i];
}
}else{
for(ll i=1;i<=n;i++){
ll x,y;
std::cin>>x>>y;
a[x]=y;
}
}
static std::vector<std::pair<ll, ll>> na;
na.resize(a.size());
for(ll i=1;i<a.size();i++){
na[i].first = a[i];
na[i].second=i;
}
std::sort(na.begin()+1,na.end());
// for(auto[x,y]:na)std::cout<<"("<<x<<","<<y<<"),";
if(na[3].first-na[1].first>na[2].first || (na[3].first-na[1].first == na[2].first && na[3].second>na[1].second)){
std::cout<<1<<'\n';
}else{
std::cout<<3<<'\n';
}
}
int main(){
std::cin>>t;
while(t--){
solve();
}
}