제출 #696122

#제출 시각아이디문제언어결과실행 시간메모리
696122thegamercoder19DNA 돌연변이 (IOI21_dna)C++17
0 / 100
48 ms3744 KiB
#include "dna.h" #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> #define M_PI 3.14159265358979323846 #define FILER 0 using ll = long long; using ull = unsigned long long; using ld = long double; const ll MOD = pow(10, 9) + 7; const ll INFL = 0x3f3f3f3f3f3f3f3f; const ull INFUL = 0x3f3f3f3f3f3f3f3f; const ll INFT = 0x3f3f3f3f; const ull MAX = 1LL << 24; const ll MODD = 998244353; const double EPS = 1e-10; #define V vector #define pll pair<ll, ll> #define pull2 pair<ull,ull> #define MS multiset #define M map #define Q queue #define PQ priority_queue #define IOF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c) #define FORR(typ,i,a,b,c) for(typ i = a; i > b; i -= c) #define FORA(a,i) for(auto &i : a) #define all(v) v.begin(),v.end() #define sz(v) v.size() #define sorta(a) sort(all(a)) #define sortd(a) sort(all(a), greater<ll>()) #define setp(x) setprecision(x)<<fixed #define RET return #define log(a,b) log(b)/log(a) #define WH(s) while(s) #define WHI(t) WH(t--) #define YES cout<<"YES"<<endl; #define NO cout<<"NO"<<endl; #define Yes cout<<"Yes"<<endl; #define No cout<<"No"<<endl; #define YESNO(s) cout << (s ? "YES" : "NO") << endl; #define YesNo(s) cout<<(s?"Yes":"No")<<endl; #define TYP 0 using namespace std; string a, b; ll n, ans; V<bool> used; map<char, V<ll>> h; V<pll> g; void dfs(ll u) { used[u] = 1; ans++; if (!used[g[u].second])dfs(g[u].second); } void init(std::string a1, std::string b1) { a = '$' + a1, b = '$' + b1; } int get_distance(int x, int y) { x++, y++; ll res = 0; string a1 = "$", b1 = a1; FOR(ll, i, x, y + 1, 1)a1 += a[i], b1 += b[i]; if (count(all(a1), 'A') != count(all(b1), 'A')) return -1; if (count(all(a1), 'T') != count(all(b1), 'T')) return -1; if (count(all(a1), 'C') != count(all(b1), 'C')) return -1; h.clear(); used.assign(a1.size(), 0); g.resize(a1.size(), {}); FOR(ll, i, 1, a1.size(), 1)h[b1[i]].emplace_back(i); FOR(ll, i, 1, a1.size(), 1) g[i] = { *h[a1[i]].begin(), i }, h[a1[i]].erase(h[a1[i]].begin()); sort(all(g)); FOR(ll, i, 1, a1.size(), 1) { if (used[i] || g[i].second == i) continue; ans = 0; dfs(i); res += max(0LL, ans - 1); } return res; }

컴파일 시 표준 에러 (stderr) 메시지

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:25:43: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 | #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
......
   72 |  FOR(ll, i, 1, a1.size(), 1)h[b1[i]].emplace_back(i);
      |          ~~~~~~~~~~~~~~~                   
dna.cpp:72:2: note: in expansion of macro 'FOR'
   72 |  FOR(ll, i, 1, a1.size(), 1)h[b1[i]].emplace_back(i);
      |  ^~~
dna.cpp:25:43: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 | #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
......
   73 |  FOR(ll, i, 1, a1.size(), 1)
      |          ~~~~~~~~~~~~~~~                   
dna.cpp:73:2: note: in expansion of macro 'FOR'
   73 |  FOR(ll, i, 1, a1.size(), 1)
      |  ^~~
dna.cpp:25:43: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 | #define FOR(typ,i,a,b,c) for(typ i = a; i < b; i += c)
......
   76 |  FOR(ll, i, 1, a1.size(), 1)
      |          ~~~~~~~~~~~~~~~                   
dna.cpp:76:2: note: in expansion of macro 'FOR'
   76 |  FOR(ll, i, 1, a1.size(), 1)
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...