結果
| 問題 |
No.568 じゃんじゃん 落とす 委員会
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-05-17 16:54:04 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,044 bytes |
| コンパイル時間 | 4,222 ms |
| コンパイル使用メモリ | 276,840 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-05-17 16:54:11 |
| 合計ジャッジ時間 | 4,747 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | freopen("difficulty.in","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | freopen("difficulty.out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
#define I using
#define AK namespace
#define CSPS2025 std
I AK CSPS2025;
const int maxn=1e5+10,maxm=1e3+10,mod=998244353,inf=1e18;
int n,m,u,v,w,l,r,L,R,res,ans=inf,arr[maxn],x[maxn],y[maxn],cnt[10];
vector<int>cnx[maxn],cny[maxn];
signed main()
{
freopen("difficulty.in","r",stdin);
freopen("difficulty.out","w",stdout);
cin>>n>>m;
for(int i=1;i<=n;i++)
{
cin>>arr[i]>>x[i]>>y[i];
arr[i]++;cnt[arr[i]]++;
cnx[x[i]].push_back(i);cny[y[i]].push_back(i);
R=max(R,y[i]);
}
r=R+1;
for(int l=0;l<=R+1;l++)
{
while(r)
{
if(cnt[2]+cnt[3]+cnt[4]+cnt[5]>=m)
{
break;
}
r--;
for(int i:cny[r])
{
cnt[arr[i]]--;
arr[i]++;
cnt[arr[i]]++;
}
}
if(cnt[2]+cnt[3]+cnt[4]+cnt[5]<m)
{
break;
}
ans=min(ans,cnt[3]+cnt[4]+cnt[5]);
for(int i:cnx[l])
{
cnt[arr[i]]--;
arr[i]--;
cnt[arr[i]]++;
}
/*
l++
res-=cnx[l]
r--
res+=cny[r]
*/
}
cout<<ans;
return 0;
}
vjudge1