QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130883#6669. MapaWilliams0 6ms5788kbC++143.2kb2023-07-25 16:33:262023-07-25 16:33:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-25 16:33:29]
  • 评测
  • 测评结果:0
  • 用时:6ms
  • 内存:5788kb
  • [2023-07-25 16:33:26]
  • 提交

answer

#include <bits/stdc++.h>
#define for_(i,a,b) for (int i = (a); i < (b); i++)
#define rep_(i,a,b) for (int i = (a); i <= (b); i++)
#define per_(i,a,b) for (int i = (a); i >= (b); i--)
#define pii pair<int, int>
#define pll pair<ll, ll> 
#define fi first
#define se second
#define ll long long
#define sz(a) (int)a.size()
#define all(v) v.begin(), v.end()
#define clr(x) memset(x, 0, sizeof(x))
#define ull unsigned long long
#define pb push_back
#define DEBUG(x) cerr << #x << '=' << x << endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"]=";rep_(_x,(L),(R))cerr<<a[_x]<<" "; cerr<<endl; 
	#ifdef LOCAL
#define line cout << "--------------------------------" << endl;
#define CE cout << endl;
#define CO cout << "OK" << endl;
#define D DEBUG
    #endif
#define endl '\n'
#define int long long
using namespace std;
bool be;clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
const int maxn = 2e5 + 10, mod = 998244353;// mod = 1949777;
const double EPS = 1e-3;
int n, m;
int a[maxn], b[maxn];
bool ed;

ll Get(int a, int b) {
	a %= mod;
	ll ans = 1; 
	while(b) {
		if (b & 1) ans = ans * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return ans;
}
int c[105][105], d[105]; 
void Gaosi(int x) {
	if (x == n + 1) return;
	for (int i = x; i <= n; i++) {
		if (c[i][x]) {
			swap(c[i], c[x]);
			swap(b[i], b[x]);
			break;
		}
	}
	for (int i = 1; i <= n; i++) {
		if (i == x) continue;
		int inv = c[i][x] * Get(c[x][x], mod - 2) % mod;
		for (int j = 1; j <= n; j++) {
			c[i][j] = c[i][j] - inv * c[x][j] % mod;
			c[i][j] %= mod;
		}
		b[i] -= inv * b[x] % mod; b[i] %= mod;
	}
	Gaosi(x + 1);
	return;
}
void solve1() {
	cin >> n;
	rep_(i, 1, n) {
		cin >> a[i] >> b[i];
		rep_(j, 1, n) c[i][j] = Get(a[i], j);
	}
	Gaosi(1);
	cout << n * 30 << endl;
	rep_(i, 1, n) {
		b[i] = b[i] * Get(c[i][i], mod - 2) % mod;
		c[i][i] = 1;
		b[i] = (b[i] + mod) % mod;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= 29; j++) {
			cout << (b[i] >> j & 1);
		}
	}
	cout << endl;
//	rep_(i, 1, n){
//		rep_(j, 1, n) {
//			cout << c[i][j] << ' ';
//		}
//		cout << b[i]; 
//		cout << endl;
//	}
}
int k;
void solve2() {
	cin >> n >> k >> m;
	rep_(i, 1, n) {
		char c;
		d[i] = 0;
		int p = 1;
		for (int j = 0; j <= 29; j++) {
			cin >> c;
			d[i] = d[i] + (c - '0') * p;
			p <<= 1;
		}
	}
	rep_(i, 1, k) {
		int x; cin >> x;
		int y = 0;
		rep_(j, 1, n) {
			y = y + Get(x, j) * d[j] % mod;
			y %= mod;
		}
		cout << y << endl;
	}
}
signed main() {
	#ifdef LOCAL
		freopen("w.in", "r", stdin);
//		freopen("w.out", "w", stdout);
		startTime = clock();
//		time_t now_time = time(NULL); tm* TuT = localtime(&now_time); cout << asctime(TuT); cout << "CodeBegin:_______________________" << endl;
//		cout << "Memory footprint:" << ((&be - &ed) >> 20) <<"MB"<< endl;
//		line;
	#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
  //int tt; cin >> tt; while(tt--) solve();
  	int T;
  	cin >> T;
  	if (T == 1) {
  		solve1();
	  } 
	else
	solve2();
  	#ifdef LOCAL
  	cerr<<"\n\n-----------------------\nProgram done in "<<clock()-startTime<<" ms";
	#endif
 	return 0; 
}
//by whc
// check if over int , and open long long !!!

// 

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 100
Accepted
time: 6ms = 5ms + 1ms
memory: 5632kb,3608kb

input:

1
100
495528311 963488152
269613430 443544124
700489871 792354118
151890319 506569919
180452297 13229948
684464994 543841485
978085128 903812192
238355172 441140842
28061035 783291471
530823766 718942732
936853023 439421263
201361623 226633955
304644844 778868118
864860135 461524170
88300500 6959354...

output:

3000
0111111110100110110010001100111100110101101001110101101101010010000101011100101111110101111011101000101011111100101001000111111100111100011010100000010100010010000101110111001110011000110001011010100100110100110010100111110111110111010000100000100001100100000011110101111000011001000110111011011...

input:

2
100 79 3000
0111111110100110110010001100111100110101101001110101101101010010000101011100101111110101111011101000101011111100101001000111111100111100011010100000010100010010000101110111001110011000110001011010100100110100110010100111110111110111010000100000100001100100000011110101111000011001000110...

output:

310305144
821194635
174780370
903812192
805026231
996046536
439421263
645287342
90686849
20101025
440972097
543841485
176553522
249563964
461524170
348624865
848301562
506569919
306718453
206848250
382805509
278712030
964702808
868944393
493895143
39665197
574757075
441140842
785665865
229376884
551...

result:

points 1.0 ok K = 3000

Test #2:

score: 100
Accepted
time: 6ms = 5ms + 1ms
memory: 5788kb,3652kb

input:

1
100
743248071 842720888
367650901 130970775
297946283 705168964
771526942 537186020
245003150 707948455
643491261 668001146
311535032 293708068
183828318 18515526
593973840 915870006
102456762 64193833
729806890 839221652
47145974 35682954
668676377 228428310
370700393 569441954
250911162 48980047...

output:

3000
1010100001010111111010010000010001111111011001111100001100110101101001011011111101011100010101001100000010111000111111101010000011111010100110001000111111000001111000100010110000001100100100010110001111010100011100111110011101010111000100110010000101001001101001011000100001111100011100111010000...

input:

2
100 79 3000
1010100001010111111010010000010001111111011001111100001100110101101001011011111101011100010101001100000010111000111111101010000011111010100110001000111111000001111000100010110000001100100100010110001111010100011100111110011101010111000100110010000101001001101001011000100001111100011100...

output:

442563406
97578442
469403815
293708068
138158276
720700065
839221652
674386240
810209830
563527225
259979005
668001146
813899310
943777483
569441954
226088806
825435650
537186020
131383422
83733737
830289758
425793016
858146541
609883097
414389335
407054915
47572024
18515526
276587480
810627636
4972...

result:

points 1.0 ok K = 3000

Test #3:

score: 100
Accepted
time: 5ms = 4ms + 1ms
memory: 3572kb,3608kb

input:

1
100
770174568 168127255
893508708 185778664
976425263 477317099
287595878 512153851
621600374 418802856
818787535 612197605
796811122 566496677
789841517 873731343
43178468 619503942
597852289 471053284
66112404 635260765
158101403 199253397
680158192 123081916
626776438 29107026
721141470 5177084...

output:

3000
1000001111101000111100100000110000001010100001110110110001000101000010110011100100010011000110011011100010111111000110100101001111000010001110100000001110100011101111010110101001111011000011001101000101000011011001001110010110100011011101001111100101010110101001110000000101011001011001010101101...

input:

2
100 79 3000
1000001111101000111100100000110000001010100001110110110001000101000010110011100100010011000110011011100010111111000110100101001111000010001110100000001110100011101111010110101001111011000011001101000101000011011001001110010110100011011101001111100101010110101001110000000101011001011001...

output:

676203467
418593456
222540092
566496677
487711174
155177230
635260765
19655934
405420089
197948311
16997620
612197605
623431791
654167214
29107026
103769907
951695033
512153851
401411177
839097490
141196222
886472586
767476542
270436089
885084406
492744649
861074271
873731343
744691837
300804222
364...

result:

points 1.0 ok K = 3000

Test #4:

score: 100
Accepted
time: 6ms = 5ms + 1ms
memory: 5776kb,3484kb

input:

1
100
546594289 9670068
665528790 773039281
266567267 744830423
338924380 918542055
413001686 717894752
786408307 211692098
280986141 432842000
195582858 921321743
412109607 485887870
262421557 244551274
303481411 585109375
922835159 77375674
276669713 485047938
748493209 63888398
37129726 285918022...

output:

3000
0001001100001111010110010001101100101111001000011011001100010000100100100111111011100000001110101110000011000111001011100000110111110110111000101100010101110001010010110110000010011100100110001111011011001100001000001111101011001010111100011000110011000100000001111110111010011001100110011101010...

input:

2
100 79 3000
0001001100001111010110010001101100101111001000011011001100010000100100100111111011100000001110101110000011000111001011100000110111110110111000101100010101110001010010110110000010011100100110001111011011001100001000001111101011001010111100011000110011000100000001111110111010011001100110...

output:

43372101
204611063
352593757
432842000
142147490
891337416
585109375
743309504
647533065
464964608
876089821
211692098
955710889
971589766
63888398
781195091
748872098
918542055
738134414
271774069
559783342
631668225
32245370
502187994
978371138
563783889
900635155
921321743
760555399
270665755
276...

result:

points 1.0 ok K = 3000

Test #5:

score: 100
Accepted
time: 5ms = 4ms + 1ms
memory: 3740kb,3592kb

input:

1
100
326454605 159474960
11647328 932941462
367166680 626258331
846588658 385992166
148602944 380296908
32123445 521548223
146657758 872883623
78417135 361494853
902204073 975297913
50096537 520296997
687284103 420187394
93781442 87808395
503014564 573344902
720903126 546124141
87676450 646360824
9...

output:

3000
1100100110001000011011111001100101100111101110111001011110111101100100010101010011101010011000010001110011011101010001000010110011111001001100110110111100110000111000101001110010001110011001001010010011000110010000010001100101011100110110011100011110001100110101101010111001011110101010000100011...

input:

2
100 79 3000
1100100110001000011011111001100101100111101110111001011110111101100100010101010011101010011000010001110011011101010001000010110011111001001100110110111100110000111000101001110010001110011001001010010011000110010000010001100101011100110110011100011110001100110101101010111001011110101010...

output:

744601533
267129639
871217352
872883623
255371549
162360942
420187394
62984915
242781986
691399852
480380990
521548223
206206675
214089065
546124141
380557861
669664079
385992166
150840342
413877880
634078816
965530575
770169571
451364705
804171981
524846617
166621075
361494853
603970305
891038427
6...

result:

points 1.0 ok K = 3000

Test #6:

score: 0
Wrong Answer
time: 6ms = 5ms + 1ms
memory: 5624kb,3468kb

input:

1
100
64333280 212072142
621741906 581061751
485561139 692210649
992259436 287935018
247191279 473618369
757620730 140577613
737479792 180977604
404566245 999575096
265846881 11981569
207666352 505750476
304958822 388901054
389584560 428620342
171809402 115660346
324907936 144402645
844495803 791121...

output:

3000
1010000100000101001011110010010110100011010000010101100101001100010000000101011100010101001001110111001110001001100011001101101010000001000110010101110011000100001101111111011010110111010100000100111101000110101111000111101001110100101011101010010011011001011000111010001111011111110000111001001...

input:

2
100 79 3000
1010000100000101001011110010010110100011010000010101100101001100010000000101011100010101001001110111001110001001100011001101101010000001000110010101110011000100001101111111011010110111010100000100111101000110101111000111101001110100101011101010010011011001011000111010001111011111110000...

output:

925952390
770406569
77034978
180977604
957934192
99668862
388901054
858699296
371495636
28514411
68070922
140577613
781757001
847250666
144402645
346058199
267461021
287935018
989151756
348668969
556273495
997895853
95321369
938341707
276009971
101428817
899728485
1330743
385642796
181794009
7525840...

result:

wrong answer wrong answer on query #28: read 1330743 but expected 999575096