QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#305618 | #6812. Draw a triangle | lmeowdn# | WA | 5ms | 3792kb | C++14 | 1.9kb | 2024-01-15 18:27:57 | 2024-01-15 18:27:59 |
Judging History
answer
//vanitas vanitatum et omnia vanitas
#include<bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x) {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x) {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x) {return (x==0?-1:__builtin_ctzll(x));}
#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
int x=0,w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();}
return x*w;
}
int ax,bx,ay,by,tss,ansx,ansy;
int sz(int x,int y) {
int sx=x-ax, sy=y-ay;
int tx=x-bx, ty=y-by;
int ss=sx*ty-sy*tx;
if(ss<0) ss=-ss;
return ss;
}
void upd(int x,int y) {
int ss=sz(x,y);
if(ss==0) return;
if(ss<tss) tss=ss, ansx=x, ansy=y;
}
signed main() {
int T=read();
while(T--) {
ax=read(), ay=read(), bx=read(), by=read();
int x=(ax+bx)/2, y=(ay+by)/2;
tss=0x3f3f3f3f3f3f3f3f;
upd(x,y), upd(x+1,y), upd(x,y+1), upd(x+1,y+1);
upd(x-1,y), upd(x-1,y-1), upd(x,y-1);
upd(x-1,y+1), upd(x+1,y-1);
printf("%lld %lld\n",ansx,ansy);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3748kb
input:
3 1 0 1 4 0 1 0 9 0 0 2 2
output:
2 2 1 5 2 1
result:
ok T=3 (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 3792kb
input:
50000 66620473 -33485015 66620223 -33485265 43307886 98029243 43307636 98028994 -88895230 -3180782 -88895480 -3181030 -90319745 20018595 -90319995 20018348 -56783257 84789686 -56783507 84789440 -81798038 90629147 -81798288 90628902 98942945 -939146 98942695 -939390 -42532151 -57203475 -42532401 -572...
output:
66620349 -33485140 43307762 98029119 -88895354 -3180905 -90319869 20018472 -56783381 84789564 -81798162 90629025 98942821 -939267 -42532275 -57203596 53500083 -30665725 27114930 46989014 -2657536 26865344 40614058 17923301 -47650028 96037593 92954171 -64535036 86508741 -51415283 -82017824 17392457 7...
result:
wrong answer wa on query #2 (test case 2)