結果
| 問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-20 23:41:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,930 bytes |
| コンパイル時間 | 1,498 ms |
| コンパイル使用メモリ | 168,212 KB |
| 実行使用メモリ | 10,112 KB |
| 最終ジャッジ日時 | 2025-02-20 23:41:51 |
| 合計ジャッジ時間 | 8,097 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 5 |
| other | WA * 32 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 100010
#define len 27
#define M 4000
int n,w,h,a,b,x,ex[M],cnt[N],z[N],ansa,ansb;
multiset<int> s[M];
signed main(){
cin>>n>>w>>h;
for(int i=1;i<=w;i++){
z[i]=(i+len-1)/len;
cnt[i]=h;
s[z[i]].insert(h);
}
for(int t=1;t<=n;t++){
cin>>a>>b>>x;
int pre=b;
b=x+a-1;
a=x;
x=pre;
if(z[a]==z[b]){
for(int i=a;i<=b;i++){
if(s[z[i]].find(cnt[i])==s[z[i]].end()){
continue;
}
s[z[i]].erase(s[z[i]].find(cnt[i]));
cnt[i]-=x;
s[z[i]].insert(cnt[i]);
}
while((!s[z[a]].empty())&&(*s[z[a]].begin()<=ex[z[a]])){
if(t%2==1){
ansa++;
}
else{
ansb++;
}
s[z[a]].erase(s[z[a]].find((*s[z[a]].begin())));
}
}
else{
for(int i=z[a]*len+1;i<=(z[b]-1)*len;i+=len){
ex[z[i]]+=x;
while(!s[z[i]].empty()&&(*s[z[i]].begin()<=ex[z[i]])){
if(t%2==1){
ansa++;
}
else{
ansb++;
}
s[z[i]].erase(s[z[i]].find((*s[z[i]].begin())));
}
}
for(int i=a;i<=z[a]*len;i++){
if(s[z[i]].find(cnt[i])==s[z[i]].end()){
continue;
}
s[z[i]].erase(s[z[i]].find(cnt[i]));
cnt[i]-=x;
s[z[i]].insert(cnt[i]);
}
while(!s[z[a]].empty()&&(*s[z[a]].begin()<=ex[z[a]])){
if(t%2==1){
ansa++;
}
else{
ansb++;
}
s[z[a]].erase(s[z[a]].find((*s[z[a]].begin())));
}
for(int i=(z[b]-1)*len+1;i<=b;i++){
if(s[z[i]].find(cnt[i])==s[z[i]].end()){
continue;
}
s[z[i]].erase(s[z[i]].find(cnt[i]));
cnt[i]-=x;
s[z[i]].insert(cnt[i]);
}
while(!s[z[b]].empty()&&(*s[z[b]].begin()<=ex[z[b]])){
if(t%2==1){
ansa++;
}
else{
ansb++;
}
s[z[b]].erase(s[z[b]].find((*s[z[b]].begin())));
}
}
}
if(ansa<ansb){
cout<<"B"<<endl;
}
else if(ansa==ansb){
cout<<"DRAW"<<endl;
}
else{
cout<<"A"<<endl;
}
cout<<ansa<<' '<<ansb<<endl;
return 0;
}