結果
| 問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-02-23 14:28:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 917 bytes |
| コンパイル時間 | 1,605 ms |
| コンパイル使用メモリ | 166,532 KB |
| 実行使用メモリ | 9,848 KB |
| 最終ジャッジ日時 | 2025-02-23 14:29:01 |
| 合計ジャッジ時間 | 3,545 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 5 |
| other | WA * 32 |
ソースコード
#include<bits/stdc++.h>
//#define DEBUG
const int N=1e5+10; int c[N]; std::vector<std::pair<int,int> >v[N];
void add(int x,int y) { for(;x<N;x+=x&-x) c[x]+=y; }
int sum(int x) { int ans=0; for(;x;x-=x&-x) ans+=c[x]; return ans; }
int main() {
//freopen("game.in","r",stdin);
//freopen("game.out","w",stdout);
std::ios::sync_with_stdio(false),std::cin.tie(nullptr);
int n,w,h,a=0,b=0; std::cin>>n>>w>>h;
for(int i=1,a,b,x;i<=n;i++) std::cin>>a>>b>>x,v[x].push_back({i,b}),v[x+a].push_back({i,-b});
for(int i=1;i<=w;i++) {
for(auto j:v[i]) add(j.first,j.second);
int l=1,r=n,ans=0;
while(l<=r) {
int m=(l+r)>>1;
if(sum(m)>=h) ans=m,r=m-1;
else l=m+1;
}
if(ans) (ans&1?a++:b++);
}
if(a>b) std::cout<<'A';
if(a<b) std::cout<<'B';
if(a==b) std::cout<<"DRAW";
std::cout<<'\n'<<a<<' '<<b;
return 0;
}
vjudge1