QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#877732 | #1133. Monster Game | modwwe | Compile Error | / | / | C++23 | 3.5kb | 2025-02-01 02:05:17 | 2025-02-01 02:05:17 |
Judging History
This is the latest submission verdict.
- [2025-02-01 02:05:17]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-01 02:05:17]
- Submitted
answer
/// try my best
//#include "monster.h"
#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task2 "ftree"
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pb push_back
#define mask(k) (1<<k)
#define mp make_pair
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
#define getchar_unlocked getchar
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
inline int scan()
{
char c = getchar_unlocked();
int x = 0;
while (c < '0' || c > '9')
{
c = getchar_unlocked();
}
while (c >= '0' && c <= '9')
{
x = (x << 1) + (x << 3) + c - '0';
c = getchar_unlocked();
}
return x;
}
void phongbeo();
const int inf = 1e16;
const ll mod2 = 1e9+7;
const int mod1 = 998244353;
const ll base=67;
int add(int x,int y)
{
if(x+y>=mod2) x-=mod2;
if(x+y<0)x+=mod2;
return x+y;
}
struct icd
{
long double a;
int b;
};
struct ib
{
int a;
int b;
};
struct ic
{
int a,b,c;
};
struct id
{
int a, b, c, d;
};
struct ie
{
int a, b, c, d, e;
};
ll n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center;
ll i, s10, s12,k1,k2,k3,s11,lim,w,l,r ;
ll kk;
ll el = 19;/*
main()
{
if(fopen(task2".inp","r"))
{
fin(task2);
fou(task2);
}
if(fopen(task".inp","r"))
{
fin(task);
fou(task);
}
NHP
/// cin>>s1;
//modwwe
phongbeo(),down
// checktime
}*/
/// read sol
/// code trâu ra nhân xét
/// [1,0] [3,2,1] [7,6,5,4]
/// vì giả sử [1,0] [3,2] thì 1 sẽ chỉ còn lớn hơn 2 nên bắt buộc phải 1
vector<int> h,a;/*
bool Query(int x, int y)
{
if(abs(h[x]-h[y])==1)return h[x]<h[y];
return h[x]>h[y];
}*/
int cast(int y)
{
dem=0;
for(int i=0; i<n; i++)
{
if(i==y) continue;
dem+=Query(a[y],a[i]);
}
return dem;
}
vector<int> Solve(int n)
{
a.pb(0);
if(n==1) return a;
for(int i=1; i<n; i++)
{
l=0;
r=a.size()-1;
while(l<=r)
{
int mid=l+r>>1;
if(Query(i,a[mid])) l=mid+1;
else r=mid-1;
}
a.insert(a.begin()+l,i);
}
int hihi;
s2=cast(0);
if(s2==1)
{
s3=cast(1);
if(s3==1)hihi=1;
else hihi=0;
}
else
{
hihi=s2;
}
int start=0;
vector<int> ans;
ans.resize(n);
while(start<n)
{
for(int j=start; j<=hihi; j++)
ans[a[j]]=start-j+hihi;
int dd=hihi+1;
while(dd<n&&Query(a[dd],a[start]))dd++;
start=hihi+1;
hihi=dd;
}
return ans;
}
void phongbeo()
{
cin>>n;
for(int i=0; i<n; i++)
cin>>s2,h.pb(s2);/*
for(int i=1; i<=n; i++)
h.pb(i);
shuffle(h.begin(),h.end(),rd);
*/
dem=0;
vector<int> k=Solve(n);
dem=0;
for(auto x:k)
{ cout<<x,down
if(x!=h[dem])
{
for(auto f:h)
cout<<f<<" ";
down
}
dem++;
}
}
详细
answer.code:39:17: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+16’ to ‘2147483647’ [-Woverflow] 39 | const int inf = 1e16; | ^~~~ answer.code: In function ‘int cast(int)’: answer.code:110:14: error: ‘Query’ was not declared in this scope 110 | dem+=Query(a[y],a[i]); | ^~~~~ answer.code: In function ‘std::vector<int> Solve(int)’: answer.code:125:16: error: ‘Query’ was not declared in this scope 125 | if(Query(i,a[mid])) l=mid+1; | ^~~~~ answer.code:151:21: error: ‘Query’ was not declared in this scope 151 | while(dd<n&&Query(a[dd],a[start]))dd++; | ^~~~~