結果
| 問題 |
No.2372 既視感
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-07-12 17:15:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,023 bytes |
| コンパイル時間 | 2,045 ms |
| コンパイル使用メモリ | 212,248 KB |
| 最終ジャッジ日時 | 2025-02-15 10:05:24 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 RE * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ld inf=10000999999999900;
int main(){
ll n,k,q;
cin >> n >> k >> q;
map<string,ll>memo;
queue<string>que;
vector<ll>ans;
for (ll i = 0; i < q; i++)
{
ll t;
cin >> t;
if (t==1)
{
string s;
cin >> s;
memo[s]++;
que.push(s);
while (que.size()>n)
{
string t=que.front();
que.pop();
memo[t]--;
}
}else{
vector<string>t(6);
vector<ll>d(6);
for (ll j = 0; j < 6; j++)
{
cin >> t[j] >> d[j];
}
ll a=0,x=0;
x++;
bool ok=true;
for (ll j = 0; j < 6; j++)
{
if (memo[t[j]]>=1)
{
a+=min(k,d[j]);
if (a>60)
{
a-=min(k,d[j]);
x--;
ok=false;
break;
}
}else{
a+=d[j];
if (a>60)
{
a-=d[j];
x--;
ok=false;
break;
}
}
if (!ok)
{
break;
}
x++;
}
for (ll j = 0; j < x; j++)
{
memo[t[j]]++;
que.push(t[j]);
}
while (que.size()>n)
{
string s=que.front();
que.pop();
memo[s]--;
}
ans.push_back(x);
}
}
for (ll i = 0; i < ans.size(); i++)
{
cout << ans[i] << endl;
}
}
hiro71687k