QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#403371#8124. Vrsarlfxxx#17 45ms6200kbC++141.0kb2024-05-02 09:41:392024-05-02 09:41:40

Judging History

你现在查看的是最新测评结果

  • [2024-05-02 09:41:40]
  • 评测
  • 测评结果:17
  • 用时:45ms
  • 内存:6200kb
  • [2024-05-02 09:41:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 1e5 + 5;
int n, m, b[N], suf[N], pre[N];
struct node {
	int x, t, s;
}a[N];
bool en;
int main()
{
	cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
	freopen("in.in", "r", stdin);
//	freopen("out.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].t >> a[i].s;
	sort(a + 1, a + 1 + n, [](node a, node b) {
		return a.x < b.x;
	});
	for (int i = 1; i <= n; ++i) b[i] = a[i].x;
	for (int i = 1; i <= n; ++i) {
		pre[i] = max(pre[i - 1], a[i].t + b[i]);
	}
	for (int i = n; i >= 1; --i) {
		suf[i] = max(suf[i + 1], a[i].t - b[i]);
	}
	while (m--) {
		int x;
		cin >> x;
		int p = lower_bound(b + 1, b + 1 + n, x) - b;
		cout << max(suf[p] + x, pre[p - 1] - x) << ' ';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3860kb

input:

10 10
466367251 100233480 856646172
23616136 95836624 848167799
285824526 504732766 778781745
484144310 45902528 249884410
77146428 247312488 457658792
303741999 449119889 822567584
310490877 635450008 523068941
688770771 830721934 666426060
895820438 617674687 350595970
688493520 120110545 31964270...

output:

324959131 778061457 595585027 409366057 787995914 441429980 363382174 592662119 864828222 452101770 

result:

wrong answer 9th numbers differ - expected: '654664483', found: '864828222'

Subtask #2:

score: 17
Accepted

Test #7:

score: 17
Accepted
time: 24ms
memory: 6184kb

input:

100000 1
53320039 48316003 37819925
770863640 910315870 957734835
466906749 791126408 442399500
312027241 11301038 565496103
691485660 603958964 574732654
989479682 728111217 647104072
843191799 685573031 570351670
169795677 685358070 641488997
795703430 994805186 294018870
21473670 875523013 991777...

output:

995983978 

result:

ok 1 number(s): "995983978"

Test #8:

score: 17
Accepted
time: 26ms
memory: 6076kb

input:

100000 1
685937245 290795880 211005526
177778952 802905227 983869446
454912298 343628505 28321462
38243172 631075776 619487766
682651221 240289602 457322605
189471916 957198086 18483085
954626959 191915417 167067901
183628752 126948548 119039254
768289318 34004952 306991192
859775708 740006350 69621...

output:

994454920 

result:

ok 1 number(s): "994454920"

Test #9:

score: 17
Accepted
time: 20ms
memory: 6132kb

input:

100000 1
789191504 222974467 26132393
643171429 29199427 429975930
93253098 986888132 818435231
622741039 92276295 625805057
415151319 82624176 231548476
709476321 824999732 515903661
202334222 501136586 414116115
329414984 918271019 283604940
350067855 973975089 40828573
862084361 617785313 3436328...

output:

999684354 

result:

ok 1 number(s): "999684354"

Test #10:

score: 17
Accepted
time: 24ms
memory: 6120kb

input:

100000 1
604474130 537620598 984504818
636918864 686701808 971616217
458766000 474373841 771601549
67713650 632411948 620684266
451553645 299309648 658068372
144019942 384532023 199919637
882493353 601022916 773880686
692096494 765549801 447544786
966280814 84732023 337666483
714553341 719139035 739...

output:

996678183 

result:

ok 1 number(s): "996678183"

Test #11:

score: 17
Accepted
time: 24ms
memory: 6120kb

input:

100000 1
852429235 916671092 532162590
8966928 790503806 940949256
397323085 213656308 750563499
43785611 637035777 248288048
355962441 365117831 490415665
340083831 211575355 25978716
138144527 577500394 229977301
94301080 551812543 232449187
585483001 615451515 628855963
181158516 954102989 794751...

output:

995372091 

result:

ok 1 number(s): "995372091"

Test #12:

score: 17
Accepted
time: 21ms
memory: 6132kb

input:

100000 1
625668756 968912537 869988252
581954375 955236546 979655664
389902987 475748907 317532424
331593993 345131384 339186032
478145777 498003101 501582528
321211625 502307105 719388732
183678728 424664429 884081646
591958022 744966912 43677765
861504705 386449465 771737197
992667988 775159187 27...

output:

994593331 

result:

ok 1 number(s): "994593331"

Subtask #3:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 1ms
memory: 3896kb

input:

1000 1000
772002074 896000991 264744112
388854298 98924088 455149297
417376884 380862219 489995490
623600709 227967696 504868695
730017345 324800592 430914592
822596051 922354700 720756605
520694263 298084968 334175049
355696669 7751208 295045433
209898888 775145315 36300658
449506116 200580532 9933...

output:

961452637 964911464 987335755 988221358 981798488 981773504 967183990 986687731 993577128 986478605 992768168 978139482 985155209 990961472 985276365 950516357 986698375 949129298 948117186 986075994 965677563 977929808 986999624 947644918 976453224 967250753 983327497 965651706 985297316 977108471 ...

result:

wrong answer 2nd numbers differ - expected: '952290361', found: '964911464'

Subtask #4:

score: 0
Wrong Answer

Test #23:

score: 0
Wrong Answer
time: 45ms
memory: 6200kb

input:

100000 100000
521965876 33870591 856400954
206067435 592933982 931261262
178283709 147934752 282409736
563063581 870421027 970567928
631801897 450778938 362656247
144968633 956983527 74676772
269211495 65706335 924510921
808188509 607096121 593666067
121621532 157123020 318243015
690651288 997566425...

output:

999323122 997589739 996663287 998100819 995409305 998365983 995816860 998097239 995435374 995864173 996140540 998474565 998680995 995191964 996510806 997491522 998643969 995686054 996326351 996624761 996647788 997380958 997894133 996030702 995259547 997186790 996066677 998682393 999666726 996362495 ...

result:

wrong answer 143rd numbers differ - expected: '995958773', found: '997996594'