QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#823036 | #9804. Guess the Polygon | ucup-team2179 | TL | 713ms | 4348kb | C++23 | 8.7kb | 2024-12-20 18:31:29 | 2024-12-20 18:31:29 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int, int>
using namespace std;
class Int {
public:
using ll = long long;
Int() {};
Int(const string& s);
Int(ll a) :Int(to_string(a)) {}
Int(const Int& bInt) :nums(bInt.nums), isPositive(bInt.isPositive), length(bInt.length) {}
Int(Int&& bInt) noexcept :nums(move(bInt.nums)), isPositive(bInt.isPositive), length(bInt.length) {}
Int(const vector<int>& vec, bool sign = true) :nums(vec), isPositive(sign) { cutLeadZero(); }
friend istream& operator >>(istream& is, Int& bInt) {
string s;
is >> s;
bInt = move(Int(s));
return is;
}
friend ostream& operator <<(ostream& os, const Int& bInt);
operator string() const;
const Int& operator +() const { return *this; }
Int operator -() const {
Int tmp(*this);
if (!tmp.isZero())
tmp.isPositive = !isPositive;
return tmp;
}
bool operator <(const Int& bInt) const;
bool operator <=(const Int& bInt) const;
bool operator ==(const Int& bInt) const;
Int operator +(const Int& bInt) const;
Int operator -(const Int& bInt) const;
Int operator *(const Int& bInt) const;
// 除法会返回 商和余数
pair<Int, Int> operator /(const Int& bInt) const;
int operator[](int idx) const { return nums[idx]; }
Int& operator =(const Int& bInt) {
if (bInt == *this)
return *this;
nums = bInt.nums;
isPositive = bInt.isPositive;
length = bInt.length;
return *this;
}
Int& operator =(Int&& bInt)noexcept {
nums = move(bInt.nums);
isPositive = bInt.isPositive;
length = bInt.length;
return *this;
}
size_t size() const { return nums.size(); }
void cutLeadZero();
bool isZero() const;
Int absValue() const {
return move(Int(nums));
}
static Int e(size_t n) {
if (n <= 0)
return move(Int(vector<int>(1, 1)));
int m = n / digit;
n -= m * digit;
vector<int> ans(m);
string s = "1";
s += move(string(n, '0'));
ans.push_back(stoi(s));
return move(Int(ans));
}
private:
// 低位到高位
vector<int> nums;
bool isPositive = 1;
int length = 0;
static int digit;
static int mod;
};
int Int::digit = 8;
int Int::mod = 100000000;
Int::Int(const string& s) {
int n = s.size(), minIdx = 0;
if(s[0]=='-')
isPositive = false, minIdx = 1;
else if(s[0]=='+')
isPositive = true, minIdx = 1;
for (int i = n - 1; i >= minIdx; i -= digit) {
int beg = max(minIdx, i - digit + 1);
nums.push_back(stoi(s.substr(beg, i - beg + 1)));
}
cutLeadZero();
}
ostream& operator <<(ostream& os, const Int& bInt) {
os << (string)bInt;
return os;
}
Int::operator string() const {
string ans;
if (!isPositive)
ans += "-";
int n = nums.size();
for (int i = n - 1; i >= 0; i--) {
string s = to_string(nums[i]);
if (i != n - 1)
ans += string(digit - s.size(), '0');
ans += s;
}
return ans;
}
bool Int::operator<(const Int& bInt) const {
if (isPositive && !bInt.isPositive)
return false;
if (!isPositive && bInt.isPositive)
return true;
bool flag = true;
if (!isPositive)
flag = false;
if (length < bInt.length)
return flag;
else if (length > bInt.length)
return !flag;
int n = size();
for (int i = n - 1; i >= 0; i--) {
if (nums[i] < bInt[i])
return flag;
else if (nums[i] > bInt[i])
return !flag;
}
return false;
}
bool Int::operator<=(const Int& bInt) const {
if (isPositive && !bInt.isPositive)
return false;
if (!isPositive && bInt.isPositive)
return true;
bool flag = true;
if (!isPositive)
flag = false; // 都为负数
if (length < bInt.length)
return flag;
else if (length > bInt.length)
return !flag;
int n = size();
for (int i = n - 1; i >= 0; i--) {
if (nums[i] < bInt[i])
return flag;
else if (nums[i] > bInt[i])
return !flag;
}
return true;
}
bool Int::operator==(const Int& bInt) const {
if (length != bInt.length)
return false;
int n = size();
for (int i = 0; i < n; i++)
if (nums[i] != bInt[i])
return false;
return true;
}
Int Int::operator+(const Int& bInt) const {
if (!bInt.isPositive)
return *this - (-bInt);
if (!isPositive)
return bInt - (-*this);
vector<int> ans;
int n = size(), m = bInt.size(), sum = 0, i = 0, j = 0;
while (i < n || j < m || sum)
{
if (i < n)
sum += nums[i++];
if (j < m)
sum += bInt[j++];
ans.push_back(sum % mod);
sum /= mod;
}
return move(Int(ans, isPositive));
}
Int Int::operator-(const Int& bInt) const
{
if (!bInt.isPositive)
return *this + (-bInt);
if (!isPositive)
return -((-*this) + bInt);
if (*this < bInt)
return -(bInt - *this);
vector<int> ans;
int i = 0, j = 0, n = size(), m = bInt.size(), sum = 0;
while (i < n || j < m || sum) {
if (i < n)
sum += nums[i++];
if (j < m)
sum -= bInt[j++];
int flag = 0;
if (sum < 0) {
flag = -1;
sum += mod;
}
ans.push_back(sum);
sum = flag;
}
return move(Int(ans));
}
Int Int::operator*(const Int& bInt) const {
int n = size(), m = bInt.size();
vector<int> ans(n + m);
using ll = long long;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
ll tmp = ans[i + j] + nums[i] * 1ll * bInt[j];
ans[i + j] = tmp % mod;
ans[i + j + 1] += tmp / mod;
}
}
return move(Int(ans, isPositive == bInt.isPositive));
}
pair<Int, Int> Int::operator/(const Int& bInt) const {
Int a = absValue();
Int b = bInt.absValue();
if (b.isZero())
return pair<Int, Int>(*this, move(b));
if (a < b)
return pair<Int, Int>(move(Int(0)), *this);
int len = a.length - b.length + 1;
string ans;
if (isPositive != bInt.isPositive)
ans = "-";
for (int i = 0; i < len; i++) {
Int tmp = e(len - i - 1) * b;
int times = 0;
while (tmp <= a) {
a = a - tmp;
++times;
}
ans += times + '0';
}
a.isPositive = isPositive;
return pair<Int, Int>(move(Int(ans)), move(a));
}
void Int::cutLeadZero() {
while(nums.size() > 1 && nums.back() == 0)
nums.pop_back();
if(nums.empty()) length = 0;
else length = (nums.size() - 1) * digit + to_string(nums.back()).size();
}
bool Int::isZero() const {
return nums.size() == 1 && nums.back() == 0;
}
Int biggcd(Int a,Int b){
if(a<Int(0ll))a=-a;
if(b<Int(0ll))b=-b;
if(a<b)swap(a,b);
if(b==Int(0ll))return a;
return biggcd(b,(a/b).second);
}
struct num{
Int a,b;
num(Int x,Int y){
Int d=biggcd(x,y);
a=(x/d).first;
b=(y/d).first;
if(b<Int(0ll)){
a=-a;
b=-b;
}
}
num(){a=0,b=1;}
num(Int x){
a=x;
b=1;
}
num(int x){
a=(Int)x;
b=1;
}
num operator+(num y){
return num(a*y.b+y.a*b,b*y.b);
}
num operator*(num y){
return num(a*y.a,b*y.b);
}
num operator/(num y){
return num(a*y.b,b*y.a);
}
num operator-(num y){
return num(a*y.b-y.a*b,b*y.b);
}
};
struct Point
{
num x,y;
Point(){}
Point(num a,num b){
x=a,y=b;
}
};
num getval(Point a1,Point a2,num x){
auto [x1,y1]=a1;
auto [x2,y2]=a2;
return y1+(y2-y1)/(x2-x1)*(x-x1);
}
num query(num u){
cout<<"? "<<u.a<<" "<<u.b<<endl;
Int x,y;
cin>>x>>y;
return num(x,y);
}
num diff=num(1ll,3ll);
void solve() {
int n;
cin>>n;
vector<int>vx;
map<int,int>mp;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
mp[x]++;
}
for(auto [x,cnt]:mp){
vx.pb(x);
}
n=vx.size();
Point val[n][2]{};
num ans(0);
if(mp[vx[0]]>1){
num now=query(num(vx[0])+diff);
val[0][1]=Point(num(vx[0])+diff,now);
}
else {
num now=num(0);
val[0][1]=Point(num(vx[0]),now);
}
if(mp[vx[n-1]]>1){
num now=query(num(vx[n-1])-diff);
val[n-1][0]=Point(num(vx[n-1])-diff,now);
}
else {
num now=num(0);
val[n-1][0]=Point(num(vx[n-1]),now);
}
for(int i=1;i<n-1;i++){
if(mp[vx[i]]==1){
num now=query(num(vx[i]));
val[i][0]=Point(num(vx[i]),now);
val[i][1]=Point(num(vx[i]),now);
}
else {
num now=query(num(vx[i])-diff);
val[i][0]=Point(num(vx[i])-diff,now);
now=query(num(vx[i])+diff);
val[i][1]=Point(num(vx[i])+diff,now);
}
}
for(int i=0;i<n-1;i++){
num high=num(vx[i+1]-vx[i]);
num len1=getval(val[i][1],val[i+1][0],num(vx[i]));
num len2=getval(val[i][1],val[i+1][0],num(vx[i+1]));
ans=ans+high*(len1+len2)/num(2ll);
}
cout<<"! "<<ans.a<<" "<<ans.b<<endl;
}
signed main() {
int t = 1;
cin >> t;
while (t--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3544kb
input:
2 4 3 0 1 3 1 1 0 0 4 3 5 3 3 0 0 999 1000 1000 999 1999 1000
output:
? 2 3 ? 4 3 ! 3 1 ? 999 1 ! 1999 2
result:
ok correct! (2 test cases)
Test #2:
score: 0
Accepted
time: 2ms
memory: 3816kb
input:
9 4 1 1 1 3 3 0 0 0 2 1 5 6 4 0 0 1 3 1 1 3 0 2 3 5 2 4 0 0 3 0 1 2 1 1 2 3 5 6 4 0 0 3 0 1 2 1 1 4 3 5 6 4 0 0 3 0 1 1 1 2 2 3 5 3 3 1000 0 0 0 0 1000 2999 3 4 0 0 1000 0 1000 1000 0 1000 1000 1 1000 1 5 0 1 1000 1000 1000 0 0 1000 1 0 2998 3 1000 1 1000 1 9 4 1000 3 1 2 1000 3 1000 1 1 2 1 0 0 1 1...
output:
? 2 3 ? 4 3 ! 5 2 ? 2 3 ? 4 3 ! 7 2 ? 2 3 ? 4 3 ! 3 2 ? 2 3 ? 4 3 ! 2 1 ? 2 3 ? 4 3 ! 5 2 ? 1 3 ! 500000 1 ? 1 3 ? 2999 3 ! 1000000 1 ? 1 3 ? 2999 3 ? 1 1 ! 1999999 2 ? 11 3 ? 2 3 ? 4 3 ? 5 3 ? 7 3 ? 8 3 ? 10 3 ! 4003 2
result:
ok correct! (9 test cases)
Test #3:
score: 0
Accepted
time: 30ms
memory: 3616kb
input:
78 8 951 614 927 614 957 614 957 604 937 614 942 619 951 610 927 604 10 1 10 1 10 1 15 1 19 3 10 1 7 562 260 602 250 582 255 587 260 602 260 562 250 577 260 10 1 10 1 10 1 5 1 10 1 3 454 98 494 68 455 68 117 4 3 526 589 566 559 527 559 117 4 3 854 496 854 466 894 466 119 4 3 797 264 827 254 857 264 ...
output:
? 2782 3 ? 2870 3 ? 937 1 ? 942 1 ? 2852 3 ? 2854 3 ! 317 1 ? 1687 3 ? 1805 3 ? 577 1 ? 582 1 ? 587 1 ! 375 1 ? 455 1 ! 585 1 ? 527 1 ! 585 1 ? 2563 3 ! 600 1 ? 827 1 ! 300 1 ? 2158 3 ! 600 1 ? 162 1 ! 400 1 ? 2227 3 ? 2375 3 ? 2240 3 ? 2242 3 ? 2255 3 ? 2257 3 ! 275 1 ? 2797 3 ? 2960 3 ? 2810 3 ? 2...
result:
ok correct! (78 test cases)
Test #4:
score: 0
Accepted
time: 124ms
memory: 3560kb
input:
34 24 123 815 168 800 133 795 27 827 153 805 28 830 178 780 138 810 78 830 192 772 148 790 88 810 43 825 183 795 103 805 163 785 118 800 93 825 63 835 73 815 58 820 198 790 48 840 108 820 10 3 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 95 6 15 2 15 1 24...
output:
? 28 1 ? 43 1 ? 48 1 ? 58 1 ? 63 1 ? 73 1 ? 78 1 ? 88 1 ? 93 1 ? 103 1 ? 108 1 ? 118 1 ? 123 1 ? 133 1 ? 138 1 ? 148 1 ? 153 1 ? 163 1 ? 168 1 ? 178 1 ? 183 1 ? 192 1 ! 1925 1 ? 54 1 ? 69 1 ? 74 1 ? 84 1 ? 89 1 ? 99 1 ? 104 1 ? 114 1 ? 119 1 ? 129 1 ? 134 1 ? 144 1 ? 149 1 ? 159 1 ? 164 1 ? 174 1 ? ...
result:
ok correct! (34 test cases)
Test #5:
score: 0
Accepted
time: 119ms
memory: 3660kb
input:
47 50 227 745 183 763 230 745 208 936 223 745 220 936 232 937 183 759 183 751 226 745 207 762 207 754 207 748 224 745 207 756 207 764 207 758 230 936 232 745 231 936 222 745 221 745 228 745 183 755 224 936 208 747 183 767 183 757 207 750 231 745 183 761 225 936 183 765 229 745 227 936 183 749 207 76...
output:
? 550 3 ? 695 3 ? 620 3 ? 622 3 ? 623 3 ? 625 3 ? 220 1 ? 662 3 ? 664 3 ? 665 3 ? 667 3 ? 668 3 ? 670 3 ? 671 3 ? 673 3 ? 674 3 ? 676 3 ? 677 3 ? 679 3 ? 680 3 ? 682 3 ? 683 3 ? 685 3 ? 686 3 ? 688 3 ? 689 3 ? 691 3 ? 692 3 ? 694 3 ! 1600 1 ? 1496 3 ? 899 3 ? 901 3 ? 902 3 ? 904 3 ? 905 3 ? 907 3 ? ...
result:
ok correct! (47 test cases)
Test #6:
score: 0
Accepted
time: 14ms
memory: 3640kb
input:
6 200 359 161 391 193 374 252 387 189 378 252 362 165 395 197 446 252 358 161 377 252 384 252 382 252 352 155 397 199 444 247 412 252 395 252 401 252 391 252 419 252 421 252 401 203 431 233 444 252 434 237 385 252 450 252 421 223 367 252 428 252 379 252 419 221 402 252 430 252 387 252 353 252 396 19...
output:
? 1051 3 ? 1349 3 ? 1055 3 ? 1057 3 ? 1058 3 ? 1060 3 ? 1061 3 ? 1063 3 ? 1064 3 ? 1066 3 ? 1067 3 ? 1069 3 ? 1070 3 ? 1072 3 ? 1073 3 ? 1075 3 ? 1076 3 ? 1078 3 ? 1079 3 ? 1081 3 ? 1082 3 ? 1084 3 ? 1085 3 ? 1087 3 ? 1088 3 ? 1090 3 ? 1091 3 ? 1093 3 ? 1094 3 ? 1096 3 ? 1097 3 ? 1099 3 ? 1100 3 ? 1...
result:
ok correct! (6 test cases)
Test #7:
score: 0
Accepted
time: 77ms
memory: 3688kb
input:
30 57 482 166 584 167 538 167 506 167 618 166 526 168 563 166 629 168 547 168 475 167 583 167 582 167 546 168 471 167 628 168 593 166 634 167 521 166 557 167 539 167 476 167 470 168 505 167 580 168 465 166 514 167 653 167 617 167 570 167 562 166 619 166 472 167 660 166 520 166 491 167 558 167 635 16...
output:
? 1396 3 ? 1991 3 ? 1406 3 ? 1408 3 ? 1409 3 ? 1411 3 ? 471 1 ? 472 1 ? 475 1 ? 476 1 ? 482 1 ? 483 1 ? 490 1 ? 491 1 ? 505 1 ? 506 1 ? 514 1 ? 515 1 ? 520 1 ? 521 1 ? 526 1 ? 527 1 ? 538 1 ? 539 1 ? 546 1 ? 547 1 ? 557 1 ? 558 1 ? 562 1 ? 563 1 ? 570 1 ? 571 1 ? 579 1 ? 580 1 ? 582 1 ? 583 1 ? 584 ...
result:
ok correct! (30 test cases)
Test #8:
score: 0
Accepted
time: 198ms
memory: 3684kb
input:
12 20 69 340 411 520 513 767 826 881 199 805 622 48 945 965 677 968 388 519 825 72 122 508 448 348 982 932 838 965 448 182 716 450 8 857 346 351 792 433 224 449 117548 223 47161313 84517 7549481525 24425413 73924992225 225575873 42227227870624 157226383481 1076496201908 3834789841 6882360591313 2278...
output:
? 69 1 ? 122 1 ? 199 1 ? 224 1 ? 346 1 ? 388 1 ? 411 1 ? 1343 3 ? 1345 3 ? 513 1 ? 622 1 ? 677 1 ? 716 1 ? 792 1 ? 825 1 ? 826 1 ? 838 1 ? 945 1 ! 566163 2 ? 100 1 ? 119 1 ? 123 1 ? 141 1 ? 152 1 ? 160 1 ? 178 1 ? 180 1 ? 183 1 ? 184 1 ? 186 1 ? 204 1 ? 213 1 ? 221 1 ? 242 1 ? 274 1 ? 279 1 ? 280 1 ...
result:
ok correct! (12 test cases)
Test #9:
score: 0
Accepted
time: 100ms
memory: 3708kb
input:
47 100 336 60 627 234 594 968 147 351 511 151 134 433 343 690 97 981 734 678 968 833 962 4 34 977 889 172 227 46 138 713 578 695 193 895 835 513 562 707 504 571 490 366 108 605 440 145 141 743 155 214 143 633 839 995 493 751 480 254 317 587 491 988 537 549 915 465 403 233 343 112 12 236 965 847 710 ...
output:
? 7 1 ? 12 1 ? 33 1 ? 101 3 ? 103 3 ? 38 1 ? 43 1 ? 97 1 ? 104 1 ? 108 1 ? 132 1 ? 134 1 ? 138 1 ? 422 3 ? 424 3 ? 143 1 ? 147 1 ? 155 1 ? 193 1 ? 227 1 ? 235 1 ? 252 1 ? 253 1 ? 268 1 ? 291 1 ? 295 1 ? 315 1 ? 317 1 ? 332 1 ? 336 1 ? 1028 3 ? 1030 3 ? 352 1 ? 355 1 ? 360 1 ? 398 1 ? 403 1 ? 405 1 ?...
result:
ok correct! (47 test cases)
Test #10:
score: 0
Accepted
time: 8ms
memory: 3612kb
input:
5 183 529 552 529 553 526 556 534 552 536 555 528 547 526 553 540 545 535 552 534 555 530 552 535 550 537 550 526 550 534 547 535 556 526 551 530 549 530 551 525 560 525 558 528 551 535 558 537 547 538 560 531 553 533 547 526 558 530 546 531 558 535 554 527 560 534 549 532 557 534 553 540 557 527 54...
output:
? 1573 3 ? 1619 3 ? 1574 3 ? 1576 3 ? 1577 3 ? 1579 3 ? 1580 3 ? 1582 3 ? 1583 3 ? 1585 3 ? 1586 3 ? 1588 3 ? 1589 3 ? 1591 3 ? 1592 3 ? 1594 3 ? 1595 3 ? 1597 3 ? 1598 3 ? 1600 3 ? 1601 3 ? 1603 3 ? 1604 3 ? 1606 3 ? 1607 3 ? 1609 3 ? 1610 3 ? 1612 3 ? 1613 3 ? 1615 3 ? 1616 3 ? 1618 3 ! 287 2 ? 30...
result:
ok correct! (5 test cases)
Test #11:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
5 195 548 38 540 29 547 28 544 29 542 33 549 37 541 26 546 33 543 38 545 33 545 26 546 24 539 35 542 26 545 35 536 28 541 28 538 33 539 31 540 24 540 25 538 32 535 36 544 34 542 38 542 28 547 32 539 25 550 25 536 30 545 30 543 23 537 34 534 36 541 29 540 37 544 26 535 29 548 36 539 27 546 32 549 29 ...
output:
? 1603 3 ? 1649 3 ? 1604 3 ? 1606 3 ? 1607 3 ? 1609 3 ? 1610 3 ? 1612 3 ? 1613 3 ? 1615 3 ? 1616 3 ? 1618 3 ? 1619 3 ? 1621 3 ? 1622 3 ? 1624 3 ? 1625 3 ? 1627 3 ? 1628 3 ? 1630 3 ? 1631 3 ? 1633 3 ? 1634 3 ? 1636 3 ? 1637 3 ? 1639 3 ? 1640 3 ? 1642 3 ? 1643 3 ? 1645 3 ? 1646 3 ? 1648 3 ! 287 2 ? 28...
result:
ok correct! (5 test cases)
Test #12:
score: 0
Accepted
time: 14ms
memory: 3844kb
input:
6 191 562 409 558 414 549 405 549 414 550 403 562 398 553 412 554 410 563 410 548 401 548 413 548 412 552 407 554 408 556 410 552 403 552 412 549 411 563 414 558 404 559 402 550 411 560 403 556 408 562 404 548 414 562 412 559 403 551 400 562 399 547 407 560 406 548 410 562 402 553 414 558 408 553 40...
output:
? 1642 3 ? 1688 3 ? 1643 3 ? 1645 3 ? 1646 3 ? 1648 3 ? 1649 3 ? 1651 3 ? 1652 3 ? 1654 3 ? 1655 3 ? 1657 3 ? 1658 3 ? 1660 3 ? 1661 3 ? 1663 3 ? 1664 3 ? 1666 3 ? 1667 3 ? 1669 3 ? 1670 3 ? 1672 3 ? 1673 3 ? 1675 3 ? 1676 3 ? 1678 3 ? 1679 3 ? 1681 3 ? 1682 3 ? 1684 3 ? 1685 3 ? 1687 3 ! 287 2 ? 29...
result:
ok correct! (6 test cases)
Test #13:
score: 0
Accepted
time: 164ms
memory: 3528kb
input:
100 4 432 383 378 564 879 428 360 237 55425 173 20674 173 9 403 900 991 82 251 377 546 339 621 826 476 904 167 637 184 206 569 464 127483 2814 5064736823 19572978 1686763227553 5774028510 48297246268163 95848873266 57736816891 86762722 82744792 117015 554528 807 7 750 849 303 479 508 268 604 865 208...
output:
? 378 1 ? 432 1 ! 41469 1 ? 184 1 ? 251 1 ? 403 1 ? 476 1 ? 546 1 ? 569 1 ? 621 1 ! 301579 1 ? 303 1 ? 508 1 ? 604 1 ? 750 1 ? 791 1 ! 324517 1 ? 228 1 ? 322 1 ! 30319 1 ? 90 1 ? 146 1 ? 179 1 ? 182 1 ? 296 1 ? 314 1 ? 318 1 ? 326 1 ? 412 1 ? 445 1 ? 446 1 ? 451 1 ? 469 1 ? 500 1 ? 546 1 ? 623 1 ? 6...
result:
ok correct! (100 test cases)
Test #14:
score: 0
Accepted
time: 609ms
memory: 4052kb
input:
10 9 243 378 841 782 148 442 136 745 35 882 560 780 385 85 443 884 953 473 28049 204 89873 204 25756 51 81469 102 19903 35 14729 199 87053 393 17 556 767 642 508 179 298 744 572 69 787 592 841 213 929 11 152 949 762 520 41 523 827 371 990 757 661 981 146 419 519 350 27 957 818 340721 4746 3276445 40...
output:
? 136 1 ? 148 1 ? 243 1 ? 385 1 ? 443 1 ? 560 1 ? 841 1 ! 558135 2 ? 69 1 ? 179 1 ? 213 1 ? 350 1 ? 371 1 ? 419 1 ? 520 1 ? 523 1 ? 556 1 ? 592 1 ? 642 1 ? 744 1 ? 757 1 ? 949 1 ? 957 1 ! 504173 1 ? 1 1 ? 6 1 ? 11 1 ? 22 1 ? 35 1 ? 41 1 ? 56 1 ? 72 1 ? 81 1 ? 92 1 ? 96 1 ? 101 1 ? 113 1 ? 114 1 ? 13...
result:
ok correct! (10 test cases)
Test #15:
score: 0
Accepted
time: 505ms
memory: 4268kb
input:
1 999 418 860 741 570 398 686 307 967 125 323 595 219 949 428 230 577 401 658 192 266 63 130 526 928 958 736 574 300 248 530 360 734 982 201 542 337 110 305 344 477 855 188 331 887 1000 410 267 449 231 634 726 482 661 708 625 719 345 3 976 556 974 446 989 64 688 137 677 862 563 762 412 960 434 947 3...
output:
? 1 3 ? 1 1 ? 2 1 ? 8 3 ? 10 3 ? 5 1 ? 6 1 ? 23 3 ? 25 3 ? 26 3 ? 28 3 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 16 1 ? 18 1 ? 19 1 ? 65 3 ? 67 3 ? 24 1 ? 25 1 ? 26 1 ? 28 1 ? 86 3 ? 88 3 ? 92 3 ? 94 3 ? 107 3 ? 109 3 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 140 3 ? 142 3 ? 143 3 ? 145 3 ? 49 1 ? 155 ...
result:
ok correct! (1 test case)
Test #16:
score: 0
Accepted
time: 156ms
memory: 3816kb
input:
100 8 965 686 363 95 657 171 462 37 13 372 46 611 839 946 375 291 92791 350 515383 793 363975 793 45734 61 42585 61 10355 22 7 384 464 164 845 825 46 292 87 14 238 329 616 458 275 95698 139 95758 165 6914 13 4993 13 2610 13 8 334 854 907 218 140 497 950 599 247 987 849 255 492 689 53 952 119329 281 ...
output:
? 46 1 ? 363 1 ? 375 1 ? 462 1 ? 657 1 ? 839 1 ! 485819 1 ? 164 1 ? 292 1 ? 329 1 ? 384 1 ? 458 1 ! 474169 2 ? 140 1 ? 247 1 ? 334 1 ? 492 1 ? 849 1 ? 907 1 ! 364259 1 ? 44 1 ? 92 1 ? 99 1 ? 102 1 ? 219 1 ? 277 1 ? 434 1 ? 447 1 ? 631 1 ? 730 1 ? 741 1 ? 800 1 ? 803 1 ? 855 1 ! 672417 2 ? 252 1 ? 30...
result:
ok correct! (100 test cases)
Test #17:
score: 0
Accepted
time: 421ms
memory: 3712kb
input:
10 127 381 549 297 504 961 486 673 617 737 870 639 562 438 661 210 337 884 488 670 963 887 728 271 264 992 860 260 650 187 121 685 794 448 797 572 932 352 480 927 172 880 121 470 933 485 258 273 288 698 340 539 671 149 299 829 56 371 971 576 105 862 199 926 209 585 837 378 125 492 202 359 453 274 57...
output:
? 28 1 ? 41 1 ? 42 1 ? 54 1 ? 60 1 ? 67 1 ? 85 1 ? 91 1 ? 94 1 ? 95 1 ? 133 1 ? 138 1 ? 147 1 ? 149 1 ? 152 1 ? 160 1 ? 170 1 ? 185 1 ? 187 1 ? 210 1 ? 213 1 ? 222 1 ? 244 1 ? 247 1 ? 260 1 ? 268 1 ? 271 1 ? 273 1 ? 274 1 ? 275 1 ? 284 1 ? 297 1 ? 313 1 ? 325 1 ? 333 1 ? 334 1 ? 341 1 ? 344 1 ? 352 ...
result:
ok correct! (10 test cases)
Test #18:
score: 0
Accepted
time: 713ms
memory: 4348kb
input:
1 997 31 967 561 563 77 899 278 232 905 414 944 891 688 470 35 589 72 942 912 459 797 102 496 946 508 427 925 744 217 287 86 2 702 732 965 675 901 433 59 200 732 623 139 180 671 907 195 275 2 631 632 574 318 798 293 785 987 60 638 532 627 641 762 432 792 837 452 842 205 700 50 874 92 920 45 76 701 8...
output:
? 1 1 ? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ?...
result:
ok correct! (1 test case)
Test #19:
score: 0
Accepted
time: 170ms
memory: 3564kb
input:
100 22 440 908 780 215 694 883 610 182 854 925 209 611 697 442 555 903 411 296 641 308 957 488 655 836 474 34 736 125 2 734 740 68 204 1000 536 750 584 558 96 296 518 344 761 693 469436 5037 86355113 277035 107224476167 332586540 876958338859 1648151076 505945614769 921273210 9254733032 17060615 508...
output:
? 96 1 ? 204 1 ? 209 1 ? 411 1 ? 440 1 ? 474 1 ? 518 1 ? 536 1 ? 555 1 ? 584 1 ? 610 1 ? 641 1 ? 655 1 ? 694 1 ? 697 1 ? 736 1 ? 740 1 ? 761 1 ? 780 1 ? 854 1 ! 845077 2 ? 283 1 ? 534 1 ? 603 1 ? 727 1 ! 136715 1 ? 75 1 ? 96 1 ? 146 1 ? 206 1 ? 224 1 ? 250 1 ? 284 1 ? 332 1 ? 410 1 ? 454 1 ? 676 1 ?...
result:
ok correct! (100 test cases)
Test #20:
score: 0
Accepted
time: 675ms
memory: 3860kb
input:
10 215 866 948 174 934 755 317 949 514 727 601 975 939 354 571 564 669 827 916 716 597 924 608 878 628 78 982 402 504 516 660 465 345 357 556 741 143 967 133 414 82 297 81 785 123 48 119 338 647 95 452 958 680 441 817 270 30 587 615 137 446 836 389 358 173 495 398 94 140 922 411 533 933 444 470 352 ...
output:
? 7 1 ? 14 1 ? 25 1 ? 36 1 ? 39 1 ? 43 1 ? 48 1 ? 49 1 ? 57 1 ? 69 1 ? 75 1 ? 78 1 ? 80 1 ? 85 1 ? 91 1 ? 92 1 ? 93 1 ? 94 1 ? 95 1 ? 102 1 ? 105 1 ? 111 1 ? 113 1 ? 114 1 ? 115 1 ? 117 1 ? 122 1 ? 123 1 ? 133 1 ? 134 1 ? 137 1 ? 140 1 ? 148 1 ? 151 1 ? 165 1 ? 167 1 ? 173 1 ? 174 1 ? 187 1 ? 190 1 ...
result:
ok correct! (10 test cases)
Test #21:
score: -100
Time Limit Exceeded
input:
1 1000 903 972 368 25 864 957 138 863 388 590 405 404 399 134 629 850 884 984 423 555 213 440 749 211 706 435 140 139 506 853 180 993 280 110 365 362 406 645 490 961 238 159 232 914 267 94 830 951 622 933 631 436 771 112 825 149 38 82 572 322 411 147 329 161 511 500 748 217 906 209 800 887 990 938 2...
output:
? 1 1 ? 2 1 ? 3 1 ? 4 1 ? 5 1 ? 6 1 ? 7 1 ? 8 1 ? 9 1 ? 10 1 ? 11 1 ? 12 1 ? 13 1 ? 14 1 ? 15 1 ? 16 1 ? 17 1 ? 18 1 ? 19 1 ? 20 1 ? 21 1 ? 22 1 ? 23 1 ? 24 1 ? 25 1 ? 26 1 ? 27 1 ? 28 1 ? 29 1 ? 30 1 ? 31 1 ? 32 1 ? 33 1 ? 34 1 ? 35 1 ? 36 1 ? 37 1 ? 38 1 ? 39 1 ? 40 1 ? 41 1 ? 42 1 ? 43 1 ? 44 1 ?...