結果
| 問題 |
No.2804 Fixer And Ratism
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2024-07-12 23:10:13 |
| 言語 | cLay (20241019-1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,029 bytes |
| コンパイル時間 | 3,233 ms |
| コンパイル使用メモリ | 189,084 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-12 23:10:42 |
| 合計ジャッジ時間 | 5,371 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:277:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
277 | write(1,a[d].c_str(),a[d].size());
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:278:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
278 | write(1,"\n",1);
| ~~~~~^~~~~~~~~~
ソースコード
#include <unistd.h>
{
LHeap<ll>h;
h.malloc(100,1);
map<string,ll>m;
string a[100];
int g[4001]{};
int k[100]{};
ll@n,@q,b=0;
rep(q){
ll@t;
if(t<1||t>3)exit(8);
if(t==1){
string@s;
if(m.find(s)!=m.end())exit(9);
ll@r;
if(r<0||r>4000)exit(10);
ll d=b++;
if(g[r])exit(13);
g[r]=d+1;
if(b>100)exit(3);
h.change(d,r);
m[s]=d;
a[d]=s;
}
if(t==2){
ll@x;
if(x<0||x>10)exit(16);
n-=x;
if(n<1)exit(4);
}
if(t==3){
string@s;
ll@x;
if(x<0||x>10)exit(15);
if(m.find(s)==m.end())exit(7);
ll d=m[s];
if(a[d]!=s)exit(6);
if(h.place[d]<0)exit(11);
ll r=h.val[d];
if(!(r>=0&&r<=4000||r>=10000&&r<=14000))exit(12);
if(g[r%10000]!=d+1)exit(14);
// if(r<4001){
// h.change(d,r+4001);
// h.change(d,r+10000);
// }
k[d]=1;
n+=x;
}
while(h.size>n){
ll d=h.pop();
if(a[d]=="")exit(5);
// wt(a[d]);
// puts(a[d].c_str());
if(k[d]&&h.val[d]<10000){
h.change(d,h.val[d]+10000);
}else{
//puts(a[d].c_str());
write(1,a[d].c_str(),a[d].size());
write(1,"\n",1);
m.erase(a[d]);
a[d]="";
}
}
}
}
tails