Poj Dual Core CPU and pojdualcorecpu
Dual Core CPU
Question:
A dual-core CPU consisting of core A and core B is provided to run N modules. The execution cost of Module I on core A is Ai, And the execution cost on core B is Bi. There are M modules (ai and bi) that need to exchange data between each other. If the two modules are executed on the same core, there is no additional cost, otherwise, the cost of wi will be generated. Calculate the minimum cost required to execute all modules.
Algorithm analysis:
Objects are divided into two sets at the minimum cost, which can be easily solved after the minimum cut.
This is a classic example of this type of problem. Consider dividing N modules into two sets based on which core they run.
Then, it is the problem of creating a graph. Because we divide the two cores into two sets, we can connect the modules running on the same core to the source or sink respectively. For example, when Ai and T are connected, Bi and S are connected, and the phone charge required for converting the core is to connect the two modules to a Wi-Fi edge respectively. Finally, the minimum cut is the answer.
# Include <iostream> # include <algorithm> # include <vector> # include <queue> # include <cstdio> # include <cstring> using namespace std; const int MAXN = 20000 + 10; const int INF = 1 <30; struct Edge {int from, to, cap, flow; Edge (){}; edge (int _ from, int _ to, int _ cap, int _ flow): from (_ from), to (_ to), cap (_ cap ), flow (_ flow) {};}; vector <Edge> edges; vector <int> G [MAXN]; int cur [MAXN], d [MAXN]; bool vst [MAXN]; int N, M, S, T; Void init () {S = N + 1; T = N + 2; for (int I = 0; I <= T; ++ I) G [I]. clear (); edges. clear ();} void addEdge (int from, int to, int cap) {edges. push_back (Edge (from, to, cap, 0); edges. push_back (Edge (to, from, 0, 0); int sz = edges. size (); G [from]. push_back (sz-2); G [to]. push_back (sz-1);} bool BFS () {queue <int> Q; memset (vst, 0, sizeof (vst); Q. push (S); vst [S] = 1; d [S] = 0; while (! Q. empty () {int u = Q. front (); Q. pop (); for (int I = 0; I <(int) G [u]. size (); ++ I) {Edge & e = edges [G [u] [I]; if (! Vst [e. to] & e. cap> e. flow) {d [e. to] = d [u] + 1; vst [e. to] = 1; Q. push (e. to) ;}}return vst [T];} int DFS (int x, int a) {if (x = T | a = 0) return; int flow = 0, f; for (int & I = cur [x]; I <(int) G [x]. size (); ++ I) {Edge & e = edges [G [x] [I]; if (d [e. to] = d [x] + 1 & (f = DFS (e. to, min (a, e. cap-e. flow)> 0) {e. flow + = f; edges [G [x] [I] ^ 1]. flow-= f; flow + = f; a-= f; if (a = 0) break;} return f Low;} int maxFlow () {int flow = 0; while (BFS () {memset (cur, 0, sizeof (cur); flow + = DFS (S, INF);} return flow;} int main () {// freopen ("Input.txt", "r", stdin); while (~ Scanf ("% d", & N, & M) {init (); int a, B, w; for (int I = 1; I <= N; ++ I) {scanf ("% d", & a, & B); addEdge (I, T, a); addEdge (S, I, B );} for (int I = 0; I <M; ++ I) {scanf ("% d", & a, & B, & w ); addEdge (a, B, w); // bidirectional. Note !!!!!!!!!! AddEdge (B, a, w);} printf ("% d \ n", maxFlow ();} return 0 ;}
How is the CPU of the CPU model Dual-Core ARMv7 Procesor?
This is COrtex-a7-based arm cpu this phone uses Qualcomm Snapdragon MSM8225 dual core processor @ 1.0 GHz
What are the meanings of dual and core in the Cpu?
Dual, adjective
Core, term
Dual core cpu is a dual-core CPU.