Submission #90491

# Submission time Handle Problem Language Result Execution time Memory
90491 2018-12-21T21:55:19 Z jasony123123 GTA (COI14_gta) C++11
50 / 100
288 ms 6360 KB
#pragma comment(linker, "/stack:200000000")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;

#define FOR(i,start,end) for(int i=start;i<(int)(end);i++)
#define FORE(i,start,end) for(int i=start;i<=(int)end;i++)
#define RFOR(i,start,end) for(int i = start; i>end; i--)
#define RFORE(i,start,end) for(int i = start; i>=end; i--)
#define all(a) a.begin(), a.end()
#define mt make_tuple
#define mp make_pair
#define v vector
#define sf scanf
#define pf printf
#define dvar(x) cout << #x << " := " << x << "\n"
#define darr(x,n) FOR(i,0,n) cout << #x << "[" << i << "]" << " := " << x[i] << "\n"

typedef long long ll;
typedef long double ld;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
//template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> void minn(T &a, T b) { a = min(a, b); }
template<class T> void maxx(T &a, T b) { a = max(a, b); }

void io() {
#ifdef LOCAL_PROJECT 
	freopen("input.in", "r", stdin); freopen("output.out", "w", stdout);
#else 
	/* online submission */

#endif 
	ios_base::sync_with_stdio(false); cin.tie(NULL);
}

const ll MOD = 1000000007LL;
const ll PRIME = 105943LL;
const ll INF = 1e18;
/****************************************************************/
stringstream ss("1364 A 0 AACGT 0 ACGTA 0 AGTAC 0 ATACG 0 CAACG 0 CGAAC 0 CGTAA 0 CTAAG 0 CTAC 0 CTTCC 0 GAACT 0 GAAG 0 GAC 0 GATCG 0 GCACG 0 GGACC 0 GGCCG 0 GTAAT 0 GTACA 0 GTAGC 0 GTATG 0 GTCAG 0 GTCC 0 GTGCG 0 GTTGG 0 TAAGT 0 TACGA 0 TACT 0 TAG 0 TC 0 TGACG 0 TTAGG 0 TTCCT 0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8 TTAC 8 TTTCC 8 AAACG 9 AGAAC 9 AGTAA 9 ATAAG 9 ATAC 9 ATTCC 9 CAAAG 9 CAAC 9 CATCC 9 CCACC 9 CCCCG 9 CGAAA 9 CGCCC 9 CGGGG 9 CGTTT 9 CTAA 9 CTATC 9 CTCAC 9 CTGCC 9 CTTAT 9 CTTCA 9 CTTGC 9 CTTTG 9 GAA 9 GAGAC 9 GATAG 9 GATC 9 GCAAG 9 GCAC 9 GCTCC 9 GGAAT 9 GGACA 9 GGAGC 9 GGATG 9 GGCAG 9 GGCC 9 GGGCG 9 GGTGG 9 GTAGA 9 GTAT 9 GTCA 9 GTCTC 9 GTGAG 9 GTGC 9 GTTCT 9 GTTG 9 TA 9 TCTAC 9 TGAAG 9 TGAC 9 TGTCC 9 TTACT 9 TTAG 9 TTC 9 TTTCG 9 AAACT 10 AAAG 10 AAC 10 AATCG 10 ACACG 10 AGACC 10 AGCCG 10 ATAAT 10 ATACA 10 ATAGC 10 ATATG 10 ATCAG 10 ATCC 10 ATGCG 10 ATTGG 10 CAAAT 10 CAACA 10 CAAGC 10 CAATG 10 CACAG 10 CACC 10 CAGCG 10 CATGG 10 CCAGG 10 CCCCT 10 CCCG 10 CGCGG 10 CGGGT 10 CTAAA 10 CTCCC 10 CTGGG 10 CTTTT 10 GAAA 10 GAATC 10 GACAC 10 GAGCC 10 GATAT 10 GATCA 10 GATGC 10 GATTG 10 GCAAT 10 GCACA 10 GCAGC 10 GCATG 10 GCCAG 10 GCCC 10 GCGCG 10 GCTGG 10 GGATT 10 GGCAT 10 GGCCA 10 GGCGC 10 GGCTG 10 GGGCT 10 GGGG 10 GGTGT 10 GTATA 10 GTCAA 10 GTGAT 10 GTGCA 10 GTGGC 10 GTGTG 10 GTTGA 10 GTTT 10 TAA 10 TAGAC 10 TATAG 10 TATC 10 TCAAG 10 TCAC 10 TCTCC 10 TGAAT 10 TGACA 10 TGAGC 10 TGATG 10 TGCAG 10 TGCC 10 TGGCG 10 TGTGG 10 TTAGA 10 TTAT 10 TTCA 10 TTCTC 10 TTGAG 10 TTGC 10 TTTCT 10 TTTG 10 AAAGA 11 AAAT 11 AACA 11 AACTC 11 AAGAG 11 AAGC 11 AATCT 11 AATG 11 ACACT 11 ACAG 11 ACC 11 ACTCG 11 AGAGG 11 AGCCT 11 AGCG 11 ATATT 11 ATCAT 11 ATCCA 11 ATCGC 11 ATCTG 11 ATGCT 11 ATGG 11 ATTGT 11 CAATT 11 CACAT 11 CACCA 11 CACGC 11 CACTG 11 CAGCT 11 CAGG 11 CATGT 11 CCAGT 11 CCCGA 11 CCCT 11 CCG 11 CGCGT 11 CTCGG 11 CTGGT 11 GAAAA 11 GACCC 11 GAGGG 11 GATTT 11 GCATT 11 GCCAT 11 GCCCA 11 GCCGC 11 GCCTG 11 GCGCT 11 GCGG 11 GCTGT 11 GGCTT 11 GGGGA 11 GGGT 11 GTGTT 11 GTTTA 11 TAAA 11 TAATC 11 TACAC 11 TAGCC 11 TATAT 11 TATCA 11 TATGC 11 TATTG 11 TCAAT 11 TCACA 11 TCAGC 11 TCATG 11 TCCAG 11 TCCC 11 TCGCG 11 TCTGG 11 TGATT 11 TGCAT 11 TGCCA 11 TGCGC 11 TGCTG 11 TGGCT 11 TGGG 11 TGTGT 11 TTATA 11 TTCAA 11 TTGAT 11 TTGCA 11 TTGGC 11 TTGTG 11 TTTGA 11 TTTT 11 AAAGG 12 AACCT 12 AACG 12 ACCGT 12 ATACC 12 ATCCG 12 CAACC 12 CACCG 12 CCCGG 12 CCGGT 12 CGGTT 12 CGTTA 12 CTAAC 12 CTTAA 12 GAAAG 12 GAAC 12 GATCC 12 GCACC 12 GCCCG 12 GGAAA 12 GGCCC 12 GGGGG 12 GGTTT 12 GTAA 12 GTATC 12 GTCAC 12 GTGCC 12 GTTAT 12 GTTCA 12 GTTGC 12 GTTTG 12 TAACT 12 TAAG 12 TAC 12 TATCG 12 TCACG 12 TGACC 12 TGCCG 12 TTAAT 12 TTACA 12 TTAGC 12 TTATG 12 TTCAG 12 TTCC 12 TTGCG 12 TTTGG 12 AAAGT 13 AACGA 13 AACT 13 AAG 13 AC 13 AGACG 13 ATAGG 13 ATCCT 13 ATCG 13 CAAGG 13 CACCT 13 CACG 13 CCCGT 13 CTACC 13 CTCCG 13 GAAAT 13 GAACA 13 GAAGC 13 GAATG 13 GACAG 13 GACC 13 GAGCG 13 GATGG 13 GCAGG 13 GCCCT 13 GCCG 13 GGCGG 13 GGGGT 13 GTAAA 13 GTCCC 13 GTGGG 13 GTTTT 13 TAAGA 13 TAAT 13 TACA 13 TACTC 13 TAGAG 13 TAGC 13 TATCT 13 TATG 13 TCACT 13 TCAG 13 TCC 13 TCTCG 13 TGAGG 13 TGCCT 13 TGCG 13 TTATT 13 TTCAT 13 TTCCA 13 TTCGC 13 TTCTG 13 TTGCT 13 TTGG 13 TTTGT 13 AAATA 14 AACAA 14 AAGAT 14 AAGCA 14 AAGGC 14 AAGTG 14 AATGA 14 AATT 14 ACAGA 14 ACAT 14 ACCA 14 ACCTC 14 ACGAG 14 ACGC 14 ACTCT 14 ACTG 14 AGAGT 14 AGCGA 14 AGCT 14 AGG 14 ATCTT 14 ATGGA 14 ATGT 14 CACTT 14 CAGGA 14 CAGT 14 CCCTA 14 CCGA 14 CCGTC 14 CCT 14 CG 14 CTCGT 14 GACGG 14 GAGGT 14 GCCTT 14 GCGGA 14 GCGT 14 GGGTA 14 TAAAA 14 TACCC 14 TAGGG 14 TATTT 14 TCATT 14 TCCAT 14 TCCCA 14 TCCGC 14 TCCTG 14 TCGCT 14 TCGG 14 TCTGT 14 TGCTT 14 TGGGA 14 TGGT 14 TTGTT 14 TTTTA 14 AAATT 15 AACAT 15 AACCA 15 AACGC 15 AACTG 15 AAGCT 15 AAGG 15 AATGT 15 ACAGT 15 ACCGA 15 ACCT 15 ACG 15 AGCGT 15 ATCGG 15 ATGGT 15 CACGG 15 CAGGT 15 CCCTT 15 CCGGA 15 CCGT 15 CGGTA 15 GAACC 15 GACCG 15 GCCGG 15 GCGGT 15 GGGTT 15 GGTTA 15 GTAAC 15 GTTAA 15 TAAAT 15 TAACA 15 TAAGC 15 TAATG 15 TACAG 15 TACC 15 TAGCG 15 TATGG 15 TCAGG 15 TCCCT 15 TCCG 15 TGCGG 15 TGGGT 15 TTAAA 15 TTCCC 15 TTGGG 15 TTTTT 15 AACGG 16 AAGGT 16 ACCTT 16 ACGGA 16 ACGT 16 AGGTA 16 CCGTT 16 CCTTA 16 CGGAA 16 CGTA 16 CGTTC 16 CTTAC 16 GAACG 16 GGAAC 16 GGTAA 16 GTAAG 16 GTAC 16 GTTCC 16 TAAGG 16 TACCT 16 TACG 16 TCCGT 16 TTACC 16 TTCCG 16 AACTA 17 AAGA 17 AAGTC 17 AAT 17 ACA 17 ACGAC 17 ACTAG 17 ACTC 17 AGACT 17 AGAG 17 AGC 17 AGTCG 17 ATAGT 17 ATCGA 17 ATCT 17 ATG 17 CAAGT 17 CACGA 17 CACT 17 CAG 17 CC 17 CGACG 17 CTAGG 17 CTCCT 17 CTCG 17 GAATT 17 GACAT 17 GACCA 17 GACGC 17 GACTG 17 GAGCT 17 GAGG 17 GATGT 17 GCAGT 17 GCCGA 17 GCCT 17 GCG 17 GGCGT 17 GTCGG 17 GTGGT 17 TAATA 17 TACAA 17 TAGAT 17 TAGCA 17 TAGGC 17 TAGTG 17 TATGA 17 TATT 17 TCAGA 17 TCAT 17 TCCA 17 TCCTC 17 TCGAG 17 TCGC 17 TCTCT 17 TCTG 17 TGAGT 17 TGCGA 17 TGCT 17 TGG 17 TTCTT 17 TTGGA 17 TTGT 17 AACTT 18 AAGGA 18 AAGT 18 ACCTA 18 ACGA 18 ACGTC 18 ACT 18 AG 18 ATCGT 18 C 18 CACGT 18 CCGTA 18 CGTAC 18 CTACG 18 GAAGG 18 GACCT 18 GACG 18 GCCGT 18 GTACC 18 GTCCG 18 TAATT 18 TACAT 18 TACCA 18 TACGC 18 TACTG 18 TAGCT 18 TAGG 18 TATGT 18 TCAGT 18 TCCGA 18 TCCT 18 TCG 18 TGCGT 18 TTCGG 18 TTGGT 18 AAGAA 19 AATA 19 AATTC 19 ACAA 19 ACATC 19 ACCAC 19 ACGCC 19 ACTAT 19 ACTCA 19 ACTGC 19 ACTTG 19 AGAGA 19 AGAT 19 AGCA 19 AGCTC 19 AGGAG 19 AGGC 19 AGTCT 19 AGTG 19 ATCTA 19 ATGA 19 ATGTC 19 ATT 19 CACTA 19 CAGA 19 CAGTC 19 CAT 19 CCA 19 CCGAC 19 CCTAG 19 CCTC 19 CGACT 19 CGAG 19 CGC 19 CGTCG 19 CTAGT 19 CTCGA 19 CTCT 19 CTG 19 GACTT 19 GAGGA 19 GAGT 19 GCCTA 19 GCGA 19 GCGTC 19 GCT 19 GG 19 GTCGT 19 TAGTT 19 TATTA 19 TCATA 19 TCCAA 19 TCGAT 19 TCGCA 19 TCGGC 19 TCGTG 19 TCTGA 19 TCTT 19 TGCTA 19 TGGA 19 TGGTC 19 TGT 19 TTGTA 19 AAGTA 20 ACGAA 20 ACTA 20 ACTTC 20 AGA 20 AGGAC 20 AGTAG 20 AGTC 20 AT 20 CA 20 CCTAC 20 CGAAG 20 CGAC 20 CGTCC 20 CTACT 20 CTAG 20 CTC 20 CTTCG 20 GAAGT 20 GACGA 20 GACT 20 GAG 20 GC 20 GGACG 20 GTAGG 20 GTCCT 20 GTCG 20 TACTT 20 TAGGA 20 TAGT 20 TCCTA 20 TCGA 20 TCGTC 20 TCT 20 TG 20 TTCGT 20 AAGTT 21 AATTA 21 ACATA 21 ACCAA 21 ACGAT 21 ACGCA 21 ACGGC 21 ACGTG 21 ACTGA 21 ACTT 21 AGCTA 21 AGGA 21 AGGTC 21 AGT 21 ATGTA 21 CAGTA 21 CCGAA 21 CCTA 21 CCTTC 21 CGA 21 CGGAC 21 CGTAG 21 CGTC 21 CT 21 G 21 GACGT 21 GCGTA 21 GGTAC 21 GTACG 21 TACGG 21 TAGGT 21 TCCTT 21 TCGGA 21 TCGT 21 TGGTA 21 AATAC 22 ACAAC 22 ACTAA 22 AGAA 22 AGATC 22 AGCAC 22 AGGCC 22 AGTAT 22 AGTCA 22 AGTGC 22 AGTTG 22 ATA 22 ATGAC 22 ATTAG 22 ATTC 22 CAA 22 CAGAC 22 CATAG 22 CATC 22 CCAAG 22 CCAC 22 CCTCC 22 CGAAT 22 CGACA 22 CGAGC 22 CGATG 22 CGCAG 22 CGCC 22 CGGCG 22 CGTGG 22 CTAGA 22 CTAT 22 CTCA 22 CTCTC 22 CTGAG 22 CTGC 22 CTTCT 22 CTTG 22 GACTA 22 GAGA 22 GAGTC 22 GAT 22 GCA 22 GCGAC 22 GCTAG 22 GCTC 22 GGACT 22 GGAG 22 GGC 22 GGTCG 22 GTAGT 22 GTCGA 22 GTCT 22 GTG 22 TAGTA 22 TCGAA 22 TCTA 22 TCTTC 22 TGA 22 TGGAC 22 TGTAG 22 TGTC 22 TT 22 ACGTT 23 ACTTA 23 AGGAA 23 AGTA 23 AGTTC 23 ATTAC 23 CATAC 23 CCAAC 23 CCTAA 23 CGAA 23 CGATC 23 CGCAC 23 CGGCC 23 CGTAT 23 CGTCA 23 CGTGC 23 CGTTG 23 CTA 23 CTGAC 23 CTTAG 23 CTTC 23 GA 23 GCTAC 23 GGAAG 23 GGAC 23 GGTCC 23 GTACT 23 GTAG 23 GTC 23 GTTCG 23 T 23 TACGT 23 TCGTA 23 TGTAC 23 TTACG 23");

map<string, int> sc;
string smallest[24] = { "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!", "!!!!!!" };

void setup() {
	int n;
	ss >> n;
	FOR(i, 0, n) {
		string s;
		int x;
		ss >> s >> x;
		sc[s] = x;
		if (s.size() < smallest[x].size())
			smallest[x] = s;
	}
}

int comp[100];

void reduce(string &str) {
	while (str.size() > 5) {
		string ending = str.substr(str.size() - 5, 5);
		FOR(i, 0, 5) str.pop_back();
		str += smallest[sc[ending]];
	}
}

int main() {
	io();
	setup();
	int N;
	cin >> N;
	FOR(i, 0, N) {
		string str;
		cin >> str;
	//	cout << i << " " << str << " ";
		reduce(str);
		comp[i] = sc[str];
	//	cout << comp[i] << "\n";
	}
	FOR(i, 0, N) {
		FOR(j, 0, N) cout << (comp[i] == comp[j]);
		cout << "\n";
	}
	return 0;
}

Compilation message

gta.cpp:1:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/stack:200000000")
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 8 ms 632 KB Output is correct
4 Correct 3 ms 800 KB Output is correct
5 Correct 3 ms 800 KB Output is correct
6 Incorrect 3 ms 820 KB Output isn't correct
7 Incorrect 3 ms 824 KB Output isn't correct
8 Incorrect 6 ms 832 KB Output isn't correct
9 Incorrect 31 ms 1400 KB Output isn't correct
10 Incorrect 288 ms 6360 KB Output isn't correct