Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <algorithm>
- using namespace std;
- typedef struct tarefa{
- int pontos;
- int inicio;
- int final;
- } tarefa;
- int main (){
- int n;
- while(cin >> n && n){
- int i, j;
- int codigo;
- int pontos;
- char dia[4];
- int inicio;
- int final;
- set<int> vseg;
- set<int> vter;
- set<int> vqua;
- set<int> vqui;
- set<int> vsex;
- vector<tarefa> tarefaseg;
- vector<tarefa> tarefater;
- vector<tarefa> tarefaqua;
- vector<tarefa> tarefaqui;
- vector<tarefa> tarefasex;
- for (i = 0; i< n; i++){
- int h1, m1;
- int h2, m2;
- scanf("%d %d %s %d:%d %d:%d", &codigo, &pontos, dia, &h1, &m1, &h2, &m2);
- inicio = h1*60+m1;
- final = h2*60+m2;
- tarefa t;
- t.pontos = pontos;
- t.inicio = inicio;
- t.final = final;
- if ((dia[0]=='S')&&(dia[1]=='e')&&(dia[2]=='g')){
- tarefaseg.push_back(t);
- } else if ((dia[0]=='T')&&(dia[1]=='e')&&(dia[2]=='t')){
- tarefater.push_back(t);
- } else if ((dia[0]=='Q')&&(dia[1]=='u')&&(dia[2]=='a')){
- tarefaqua.push_back(t);
- } else if ((dia[0]=='Q')&&(dia[1]=='u')&&(dia[2]=='i')){
- tarefaqui.push_back(t);
- } else if ((dia[0]=='S')&&(dia[1]=='e')&&(dia[2]=='x')){
- tarefasex.push_back(t);
- }
- }
- for (i = 0; i < tarefaseg.size(); i++){
- tarefa t1 = tarefaseg.at(i);
- int sum = t1.pontos;
- for (j = 0; j < tarefaseg.size(); j++){
- tarefa t2 = tarefaseg.at(j);
- if ( (t1.inicio < t2.inicio) && (t2.final < t2.final) ){
- sum += t2.pontos;
- }
- }
- vseg.insert(sum);
- }
- int seg = *vseg.end();
- int ter = *vter.end();
- int qua = *vqua.end();
- int qui = *vqui.end();
- int sex = *vsex.end();
- int total = seg + ter + qua + qui + sex;
- cout << "Total de pontos: " << total << endl;
- cout << "Seg: " << seg << endl;
- cout << "Ter: " << ter << endl;
- cout << "Qua: " << qua << endl;
- cout << "Qui: " << qui << endl;
- cout << "Sex: " << sex << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement