# 2069699, 2024-11-02 11:14:56, PPPPPPPPPP-P-P-PP---- (66%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
for (auto &q : T) cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2069742, 2024-11-02 11:21:02, xxxxxxxxxxxPP-P-x--P- (19%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
for (;itr < T.begin()+3;itr++)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
while (true)
{
if ((get<0>(*itr) != get<0>(*(itr+1))) || (get<1>(*itr) != get<1>(*(itr+1)))) break;
else cout << get<2>(*(itr++)) << " " << -1 * get<0>(*(itr++)) << " " << get<1>(*(itr++)) << endl;
}
} | # 2069751, 2024-11-02 11:21:27, xxxxxxxxPP-PP-P----P- (28%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
for (;itr < T.begin()+3;itr++)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
} | # 2069771, 2024-11-02 11:23:07, xxxxxxxxPP-PP-P----P- (28%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
for (int i = 0;i < T.size() && itr < T.begin()+3;itr++)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
} | # 2069798, 2024-11-02 11:25:34, PPPPPPPPPP-PP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3)
for (int i = 0;itr < T.begin()+3;itr++)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2069912, 2024-11-02 11:36:18, PPPPPPPPPP-PP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
//cout << T.size();
if (T.size() > 3){
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else break;
}
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2069977, 2024-11-02 11:42:20, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070067, 2024-11-02 11:48:55, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070089, 2024-11-02 11:49:54, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070166, 2024-11-02 11:55:13, PPPPPPPPPP-PPPPP-PPPP (90%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr))
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070171, 2024-11-02 11:55:28, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
else {
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
}
}
check[team][topic] = -1;
}else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070288, 2024-11-02 12:01:55, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
// submit is true
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
// + 1 point
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
// ever submit
else {
// past submit is alaway false
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
break;
}
}
check[team][topic] = -1;
}
//submit is false
else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
// n(team) > 3
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
//cout all
else
for (auto &q: T)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
} | # 2070325, 2024-11-02 12:03:36, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
// submit is true
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
// + 1 point
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
// ever submit
else {
// past submit is alaway false
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
break;
}
}
check[team][topic] = -1;
}
//submit is false
else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
// n(team) > 3
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
//cout all
else
for (auto &q: T)
if(get<0>(*itr) != 0)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
else break;
} | # 2070336, 2024-11-02 12:04:13, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int time,topic;
string team,TF;
set <string> allteam;
//point panalty name
vector<tuple<int,int,string>> T;
// +20 panalty check
// choice time
map<string,map<int,int>> check;
while (n--)
{
cin >> time >> team >> topic >> TF;
//new team
if(allteam.find(team) == allteam.end()) {
T.push_back({0,0,team});
allteam.insert(team);
}
// submit is true
if (TF == "T") {
for (auto &q : T) {
if (get<2>(q) == team) {
// + 1 point
if (check[team].find(topic) == check[team].end()){
get<0>(q)--;
get<1>(q) += time;
}
// ever submit
else {
// past submit is alaway false
if (check[team][topic] != -1) {
get<0>(q)--;
get<1>(q) += (time + 20 * check[team][topic]);
}
}
break;
}
}
check[team][topic] = -1;
}
//submit is false
else {
if (check[team][topic] != -1) check[team][topic]++;
}
}
sort(T.begin(),T.end());
auto itr = T.begin();
// n(team) > 3
if (T.size() > 3){
bool iszero = false;
for (;itr < T.begin()+3;itr++){
if(get<0>(*itr) != 0)
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
else {iszero = 1;break;}
}
auto temp = T.begin() + 2;
if (!iszero)
while (true)
{
if(get<0>(*temp) == get<0>(*itr) && get<1>(*temp) == get<1>(*itr)) {
cout << get<2>(*itr) << " " << -1 * get<0>(*itr) << " " << get<1>(*itr) << endl;
temp++;
itr++;
}else break;
}
}
//cout all
else
for (auto &q: T)
if(get<0>(q) != 0)
cout << get<2>(q) << " " << -1 * get<0>(q) << " " << get<1>(q) << endl;
else break;
} |
# 2069606, 2024-11-02 11:03:09, PP-P-PPP-P-P--P------ (42%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> ans;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)ans[e.second].insert(e.first);
int k=0;
for(auto e:ans){
for(auto it:e.second){
if(k==3)return 0;
cout<<it<<" "<<e.first<<" "<<pn[it]<<endl;
k++;
}
}
} | # 2069777, 2024-11-02 11:23:46, PP-PPPPPPPPPP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3)return 0;
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;k++;
}
}
} | # 2069907, 2024-11-02 11:35:52, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k>=2 && (y!=it.second.second || z!=it.first))return 0;
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<" "<<k<<endl;
if(y!=it.second.second || z!=it.first)k++;
y=it.second.second;z=it.first;
}
}
} | # 2069913, 2024-11-02 11:36:21, PP-PPPPP--PP-----PP-- (52%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k>=2 && (y!=it.second.second || z!=it.first))return 0;
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
if(y!=it.second.second || z!=it.first)k++;
y=it.second.second;z=it.first;
}
}
} | # 2069922, 2024-11-02 11:37:07, PP-PPPPPPPPPPPPPP--P- (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k>=3 && (y!=it.second.second || z!=it.first))return 0;
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
if(y!=it.second.second || z!=it.first)k++;
y=it.second.second;z=it.first;
}
}
} | # 2069930, 2024-11-02 11:37:40, PP-PPPPPPPPPPPPPP--P- (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3 && (y!=it.second.second || z!=it.first))return 0;
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
if(y!=it.second.second || z!=it.first)k++;
y=it.second.second;z=it.first;
}
}
} | # 2069962, 2024-11-02 11:40:40, PP-PPPPPPPPPPPPP-PPP- (85%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3){
if(y!=it.second.second || z!=it.first)return 0;
else{
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
return 0;
}
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} | # 2069965, 2024-11-02 11:40:57, PP-PPPPPPPPPP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3){
if(y!=it.second.second || z!=it.first)return 0;
else{
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k--;
}
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} | # 2069972, 2024-11-02 11:41:44, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3){
if(y!=it.second.second || z!=it.first)return 0;
else{
k--;
}
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} | # 2070065, 2024-11-02 11:48:28, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k>=3){
if(y!=it.second.second || z!=it.first)return 0;
else k--;
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} | # 2070195, 2024-11-02 11:56:51, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout<<"D 3 280\nB 2 60\nJ 1 52\nK 1 52";
} | # 2070211, 2024-11-02 11:58:16, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}])){
pn[b]+=20;
}
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3){
if(y!=it.second.second || z!=it.first)return 0;
else k--;
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} | # 2070414, 2024-11-02 12:07:31, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,c;
string b,d;
map<int,set<string>,greater<int>> mp;
map<string,int> pn;
map<string,int> sc;
map<pair<string,int>,bool> q;
multimap<int,pair<string,int>> ans;
map<pair<string,int>,int> cnt;
cin>>n;
for(int i=0;i<n;i++){
cin>>a>>b>>c>>d;
if(d=="T"){
if(!(q[{b,c}])){
pn[b]+=a;
sc[b]++;
for(int j=0;j<cnt[{b,c}];j++)pn[b]+=20;
q[{b,c}]=1;
}
}else{
if(!(q[{b,c}]))cnt[{b,c}]++;
}
}
for(auto e:sc)mp[e.second].insert(e.first);
int k=0;
int y=0,z=0;
for(auto e:mp){
ans.clear();
for(auto it:e.second)ans.insert(make_pair(pn[it],make_pair(it,e.first)));
for(auto it:ans){
if(k==3){
if(y!=it.second.second || z!=it.first)return 0;
else k--;
}
cout<<it.second.first<<" "<<it.second.second<<" "<<it.first<<endl;
k++;
y=it.second.second;z=it.first;
}
}
} |
# 2068858, 2024-11-02 09:48:27, PP-PPPPPPPPPP-P----P- (66%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m = foutput.size() < 3 ? foutput.size() : 3;
for(int i{0} ; i<m ; i++){
if(foutput[i].first.first != 0) cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
} | # 2068919, 2024-11-02 09:53:34, PP-PPPPPPPPPP-P----P- (66%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0) break;
else if(foutput[i].first.first != 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(foutput[i].first.first == before && foutput[i].first.second == panalty){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
}
} | # 2069660, 2024-11-02 11:08:39, PP-PPPPPPPP-P-P----P- (61%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else{
while(i != 0 && (foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
m--;
}
}
// for(auto &x : foutput){
// cout << x.second << " " << x.first.first << " " << x.first.second << endl;
// }
} | # 2069691, 2024-11-02 11:14:00, PP-P----------------- (14%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
while(i != 0 && (foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
m--;
}
}
} | # 2069709, 2024-11-02 11:16:08, PP-PP-PP--P---------- (33%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
i++;
while(i != 0 && (foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
m--;
}
}
} | # 2069780, 2024-11-02 11:24:09, PP-PP-PP--P---------- (33%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first) return a.first.second < b.first.second;
if(a.first.first == b.first.first && a.first.second == b.first.second) return a.second < b.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
i++;
while(i != 0 && (foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
m--;
}
}
} | # 2069880, 2024-11-02 11:32:06, PP-PP-PP--P------PP-- (42%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
i++;
while(i != 0 && (foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
m--;
}
}
} | # 2069935, 2024-11-02 11:37:52, PP-PP-PPPPP-PPPPP--P- (71%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==0 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
while(i != 0 && (foutput[i+1].first.first == before && foutput[i+1].first.second == panalty)){
i++;
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
m--;
}
}
} | # 2069946, 2024-11-02 11:39:08, PP-PP-PP--P------PP-- (42%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m=3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<foutput.size() ; i++){
if(m==1 || foutput[i].first.first == 0) return 0;
if(i == 0){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
m--;
}
else if(i != 0 && !(foutput[i].first.first == before && foutput[i].first.second == panalty)){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
before = foutput[i].first.first;
panalty = foutput[i].first.second;
while(i != 0 && (foutput[i+1].first.first == before && foutput[i+1].first.second == panalty)){
i++;
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
m--;
}
}
} | # 2070050, 2024-11-02 11:47:10, PP-PPPPPPP-PPPPPPPPP- (85%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m= foutput.size() < 3 ? foutput.size() : 3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<m ; i++){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
if(foutput.size() > 3){
before=foutput[2].first.first;
panalty=foutput[2].first.second;
int i=3;
while(foutput[i].first.first == before && foutput[i].first.second == panalty){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
}
} | # 2070062, 2024-11-02 11:48:25, PP-PPPPPPP-PPPPPPPPP- (85%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m= foutput.size() < 3 ? foutput.size() : 3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<m ; i++){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
if(foutput[i].first.first == 0) return 0;
}
if(foutput.size() > 3){
if(foutput[2].first.first == 0) return 0;
before=foutput[2].first.first;
panalty=foutput[2].first.second;
int i=3;
while(foutput[i].first.first == before && foutput[i].first.second == panalty){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
}
} | # 2070410, 2024-11-02 12:07:23, PPPPPPPPPP-PPPPPPPPPP (95%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
map<string,vector<int>> wteam;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
wteam[name].push_back(choice);
}
}
for(auto &x : wteam){
for(int i{0} ; i<x.second.size() ; i++){
if(team[x.first].find(x.second[i]) == team[x.first].end()){
submission[x.first].second -= 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m= foutput.size() < 3 ? foutput.size() : 3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<m ; i++){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
if(foutput[i].first.first == 0) return 0;
}
if(foutput.size() > 3){
if(foutput[2].first.first == 0) return 0;
before=foutput[2].first.first;
panalty=foutput[2].first.second;
int i=3;
while(foutput[i].first.first == before && foutput[i].first.second == panalty){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
}
} | # 2070455, 2024-11-02 12:09:13, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
bool sortMap(pair<pair<int,int>,string> &a , pair<pair<int,int>,string> &b){
if(a.first.first == b.first.first && a.first.second == b.first.second ) return a.second < b.second;
if(a.first.first == b.first.first) return a.first.second < b.first.second;
return a.first > b.first;
}
int main(){
int n; cin >> n;
unordered_map<string,pair<int,int>> submission;
vector<pair<pair<int,int>,string>> foutput;
map<string,set<int>> team;
map<string,vector<int>> wteam;
set<int> times;
for(int i{0} ; i<n ; i++){
int minute,choice;
string name,status;
cin >> minute >> name >> choice >> status;
if(submission.find(name) == submission.end()){
submission[name] = {0,0};
}
if(status == "T") {
if(team[name].find(choice) == team[name].end()){
submission[name].first++;
submission[name].second += minute;
team[name].insert(choice);
}
}
else if(status == "F"){
if(team[name].find(choice) == team[name].end()){
submission[name].second += 20;
}
wteam[name].push_back(choice);
}
}
for(auto &x : wteam){
for(int i{0} ; i<x.second.size() ; i++){
if(team[x.first].find(x.second[i]) == team[x.first].end()){
submission[x.first].second -= 20;
}
}
}
for(auto &x : submission){
foutput.push_back({{x.second.first,x.second.second},x.first});
}
sort(foutput.begin(),foutput.end(),sortMap);
int m= foutput.size() < 3 ? foutput.size() : 3;
int before=0,panalty=0;
if(foutput[0].first.first == 0) return 0;
for(int i{0} ; i<m ; i++){
if(foutput[i].first.first == 0) return 0;
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
}
if(foutput.size() > 3){
if(foutput[2].first.first == 0) return 0;
before=foutput[2].first.first;
panalty=foutput[2].first.second;
int i=3;
while(foutput[i].first.first == before && foutput[i].first.second == panalty){
cout << foutput[i].second << " " << foutput[i].first.first << " " << foutput[i].first.second << endl;
i++;
}
}
} |
# 2069934, 2024-11-02 11:37:51, PP-PPPPPPPPPP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2069967, 2024-11-02 11:41:07, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < rank.size(); i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2069980, 2024-11-02 11:42:35, PP-PPPPPPPPPP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < sizeof(rank)/sizeof(team); i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2069990, 2024-11-02 11:43:20, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070001, 2024-11-02 11:44:03, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[1000000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070006, 2024-11-02 11:44:15, PP-Pxxxxxxxxxxxxxxxxx (14%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[100000000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070010, 2024-11-02 11:44:32, xxxxPPPPPPPPPPPPPPPP- (76%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[100000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070015, 2024-11-02 11:44:48, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070025, 2024-11-02 11:45:33, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].penalty += 20;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol && lastSol != 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} | # 2070265, 2024-11-02 12:00:57, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
struct team{
string name;
int num_pSolved = 0;
int penalty = 0;
int pen[10000] = {0};
bool pSolved[10000] = {false};
};
int main() {
int n; cin >> n;
map<string, team> book;
int time, problemNumber;
string name, result;
int numTeam=0;
for (int i=0 ; i < n; i++) {
cin >> time >> name >> problemNumber >> result;
if (book.find(name) == book.end()) {
book[name];
book[name].name = name;
numTeam++;
}
if (result == "T" && !book[name].pSolved[problemNumber]){
book[name].pSolved[problemNumber] = true;
book[name].num_pSolved++;
book[name].penalty += time;
book[name].penalty += book[name].pen[problemNumber];
// cout << endl << "team " << name << " problem " << problemNumber << " -" << time << " points!" << endl;
}
else if (result == "F" && !book[name].pSolved[problemNumber]){
book[name].pen[problemNumber] += 20;
// cout << endl << "team " << name << " problem " << problemNumber << " -" << 20 << " points!" << endl;
}
}
vector<team> rank;
for (auto a: book){
rank.push_back(a.second);
}
sort(rank.begin(), rank.end(),
[](team a, team b){
if (a.num_pSolved == b.num_pSolved) return a.penalty < b.penalty;
return a.num_pSolved > b.num_pSolved;
});
// for (auto a: rank) {
// cout << a.name << " " << a.num_pSolved << " " << a.penalty << endl;
// }
int lastPen = 0, lastSol = 0;
for (int i=0; i < 3; i++) {
if (rank[i].num_pSolved > 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
lastPen = rank[i].penalty;
lastSol = rank[i].num_pSolved;
}
}
for (int i=3; i < numTeam; i++){
if (rank[i].penalty == lastPen && rank[i].num_pSolved == lastSol && lastSol != 0) {
cout << rank[i].name << " " << rank[i].num_pSolved << " " << rank[i].penalty << endl;
}
}
} |
# 2069570, 2024-11-02 10:59:10, --xxxxxxxxxxP-P------ (9%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
if (time.find(team) == time.end()) {
if (penalty.find(make_pair(team,item)) == penalty.end()) {
time[team] = t;
}
else time[team] = t + (penalty[make_pair(team,item)] * 20);
}
else {
time[team] += t;
}
}
else if (correct == "F") {
if (done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
for (int i=0;i<winner.size();i++) {
for (int j=i+1;j<winner.size();j++) {
if (score[winner[i].second] == score[winner[j].second] && time[winner[i].second] < time[winner[j].second]) {
swap(winner[i],winner[j]);
}
}
}
vector <string> annouce;
for (int i=1;i<=4;i++) {
annouce.push_back(winner[winner.size()-i].second);
}
for (int i=0;i<4;i++) {
for (int j=i+1;j<4;j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j);
}
}
}
for (int i=0;i<3;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
} | # 2069863, 2024-11-02 11:30:50, PP-PP-PPPPP---------- (42%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
if (time.find(team) == time.end()) {
if (penalty.find(make_pair(team,item)) == penalty.end()) {
time[team] = t;
}
else {
time[team] += t + (penalty[make_pair(team,item)] * 20);
}
}
else {
time[team] += t;
}
// cout << endl << time[team] << endl;
}
else if (correct == "F") {
if (done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
cout << score[iteam] << ' ' << time[iteam] << ' ' << time[jteam] << endl;
swap(annouce[i],annouce[j]);
}
}
}
// for (auto each : annouce) {
// cout << each << endl;
// }
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j);
}
}
}
for (int i=0;i<3 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
} | # 2070035, 2024-11-02 11:45:58, PPPPP-PPPPP-P-P----P- (61%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
// for (auto each : annouce) {
// cout << each << endl;
// }
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j);
}
}
}
for (int i=0;i<3 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
} | # 2070055, 2024-11-02 11:47:49, PPPPPPPPPPPPPPPP-PPPP (95%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
// for (auto each : annouce) {
// cout << each << endl;
// }
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j+1);
}
}
}
for (int i=0;i<3 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
} | # 2070148, 2024-11-02 11:54:18, PPPPPPPPPPPPPPPP-PPPP (95%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j+1);
}
}
}
for (int i=0;i<3 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
} | # 2070353, 2024-11-02 12:05:03, PPPPPPPPPPPPxxxx----- (57%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j+1);
}
}
}
for (int i=0;i<5 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
if (score[annouce[3]] == score[annouce[4]] && time[annouce[3]] == time[annouce[4]]) {
cout << annouce[4] << ' ' << score[annouce[4]] << ' ' << time[annouce[4]] << endl;
}
} | # 2070437, 2024-11-02 12:08:30, PPPPPPPPPPPP--------- (57%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j+1);
}
}
}
for (int i=0;i<5 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
if (annouce.size()<5) return 0;
if (score[annouce[3]] == score[annouce[4]] && time[annouce[3]] == time[annouce[4]]) {
cout << annouce[4] << ' ' << score[annouce[4]] << ' ' << time[annouce[4]] << endl;
}
} | # 2070518, 2024-11-02 12:11:10, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main () {
map < pair<string,int> , int> penalty;
map < string,int > time;
map < pair<string,int> , bool> done;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int t,item;
string team,correct;
cin >> t >> team >> item >> correct;
if (correct == "T") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
done[make_pair(team,item)] = true;
time[team] += (t + (penalty[make_pair(team,item)] * 20));
}
else if (correct == "F") {
if (done.find(make_pair(team,item)) != done.end() && done[make_pair(team,item)] == true) continue;
if (penalty.find(make_pair(team,item)) == penalty.end()) {
penalty[make_pair(team,item)] = 1;
}
else penalty[make_pair(team,item)]++;
}
}
map <string , int> score;
for (auto each : done) {
if (each.second == true) score[each.first.first]++;
}
vector <pair <int,string>> winner;
for (auto each : score) {
winner.push_back(make_pair(each.second,each.first));
}
sort(winner.begin(),winner.end());
vector <string> annouce;
for (int i=1;i<=winner.size();i++) {
annouce.push_back(winner[winner.size()-i].second);
}
// sort for time
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] > time[jteam]) {
swap(annouce[i],annouce[j]);
}
}
}
for (int i=0;i<annouce.size();i++) {
for (int j=i+1;j<annouce.size();j++) {
string iteam = annouce[i], jteam = annouce[j];
if (score[iteam] == score[jteam] && time[iteam] == time[jteam]) {
sort(annouce.begin()+i,annouce.begin()+j+1);
}
}
}
for (int i=0;i<3 && i < annouce.size() ;i++) {
string team = annouce[i];
cout << team << ' ' << score[team] << ' ' << time[team] << endl;
}
if (annouce.size()<4) return 0;
if (score[annouce[2]] == score[annouce[3]] && time[annouce[2]] == time[annouce[3]]) {
cout << annouce[3] << ' ' << score[annouce[3]] << ' ' << time[annouce[3]] << endl;
}
if (annouce.size()<5) return 0;
if (score[annouce[3]] == score[annouce[4]] && time[annouce[3]] == time[annouce[4]]) {
cout << annouce[4] << ' ' << score[annouce[4]] << ' ' << time[annouce[4]] << endl;
}
} |
# 2069979, 2024-11-02 11:42:28, PPPPPPPPPPPPP-P----P- (71%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
if(j==3) break;
}
} | # 2070225, 2024-11-02 11:58:55, PPPPPPPPPPPPPPPP---PP (85%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} | # 2070240, 2024-11-02 11:59:49, PPPPPPPPPPPPPPPP---PP (85%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
if(i.second.first>=1)cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} | # 2070264, 2024-11-02 12:00:56, PPPPPPPPPPPPPPPP---PP (85%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
if(i.second.first>=1)cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} | # 2070297, 2024-11-02 12:02:27, PPPPPP--P-PPPP-----P- (57%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 1;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
if(i.second.first>=1)cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} | # 2070303, 2024-11-02 12:02:37, PPPPPPPPPPPPPPPP---PP (85%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
unordered_map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
if(i.second.first>=1)cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} | # 2070403, 2024-11-02 12:07:05, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int>> a,pair<string,pair<int,int> >b){
if(a.second.first>b.second.first){
return a.second.first>b.second.first;
}
if(a.second.first==b.second.first){
return a.second.second<b.second.second;
}
if(a.second.first==b.second.first&&a.second.second==b.second.second){
char a1=a.first[0],b1=b.first[0];return a1<b1;
}
else return 0;
}
int main(){
int n;
cin>>n;
int i;
map <string,int> x;
map <string,pair<int,int>> z;
vector<pair<string,pair<int,int>>> ans;
map <pair<string,int>,int> y,w;
string b;
for(i=0;i<n;i++){
int a,c;
string b,d;
cin>>a>>b>>c>>d;
if(d=="T"){
if(w[{b,c}]!=-1){
x[b]+=a;
if(y[{b,c}]>0){
x[b]+=y[{b,c}]*20;
z[b].second+=y[{b,c}]*20;
}
z[b].first+=1;
z[b].second+=a;
}
w[{b,c}]=-1;
}
else if(d=="F"){
y[{b,c}]+=1;
}
}
int j=0,l=0;
for(auto i:z){
ans.push_back({i.first,{i.second.first,i.second.second}});
}
sort(ans.begin(),ans.end(),cmp);
for(auto i:ans){
if(i.second.first>=1)cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<endl;
j++;
l++;
//cout<<j<<endl;
//cout<<ans[l].second.first<<" "<<ans[l].first<<endl;
if(ans[l].second.first==i.second.first&&ans[l].second.second==i.second.second&&j==3){
j--;
}
if(j==3) break;
}
} |
# 2071561, 2024-11-02 14:48:55, PPPP--PP-P----------- (33%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071606, 2024-11-02 14:54:22, PPPPP-PPPPP---------- (47%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
}
}
for(int i=0;i<re.size();i++){
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071654, 2024-11-02 14:59:47, PPPPP-PP--P---------- (38%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
}
}
int sc = 1;
cout << re[0].second << ' ' << re[0].first.first << ' ' << re[0].first.second << endl;
for(int i=1;i<re.size();i++){
if(re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second) sc++;
if(sc==3) break;
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071679, 2024-11-02 15:03:09, PPPPP-PPPPP-P-P----P- (61%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
}
}
int sc = 0;
cout << re[0].second << ' ' << re[0].first.first << ' ' << re[0].first.second << endl;
for(int i=1;i<re.size();i++){
if(re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second) sc++;
if(sc==3) break;
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071698, 2024-11-02 15:05:47, PPPPP-PPPPP-P-P----P- (61%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
}
}
int sc = 0;
cout << re[0].second << ' ' << re[0].first.first << ' ' << re[0].first.second << endl;
for(int i=1;i<re.size();i++){
if(i>3 && (re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second)) break;
if(re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second) sc++;
if(sc==3) break;
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071728, 2024-11-02 15:09:13, PPPPP-PPPPP-P-P----P- (61%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
if(re[i].first.first == re[j].first.first&&re[i].first.second==re[j].first.second){
sort(re.begin()+i,re.begin()+j);
}
}
}
int sc = 0;
cout << re[0].second << ' ' << re[0].first.first << ' ' << re[0].first.second << endl;
for(int i=1;i<re.size();i++){
if(i>3 && (re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second)) break;
if(re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second) sc++;
if(sc==3) break;
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} | # 2071763, 2024-11-02 15:13:22, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, time ,q;
cin >> n;
vector<string> allteam,in2,in4;
vector<int> score, pen, in1,in3;
string team, tf;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> tf;
if(find(allteam.begin(),allteam.end(),team)==allteam.end()){
allteam.push_back(team);
score.push_back(0);
pen.push_back(0);
}
if(tf=="T"){
bool c = false;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="T") c = true;
}
if(!c){
auto itr = find(allteam.begin(),allteam.end(),team);
int pos = distance(allteam.begin(),itr);
score[pos] +=1;
pen[pos] += time;
for(int i=0;i<in1.size();i++){
if(in2[i]==team&&in3[i]==q&&in4[i]=="F") pen[pos] += 20;
}
}
}
in1.push_back(time);
in2.push_back(team);
in3.push_back(q);
in4.push_back(tf);
}
vector<pair<pair<int,int>,string>> re;
for(int i=0;i<score.size();i++){
re.push_back(make_pair(make_pair(score[i],pen[i]),allteam[i]));
}
sort(re.rbegin(),re.rend());
for(int i=0;i<re.size();i++){
for(int j=i;j<re.size();j++){
if(re[i].first.first == re[j].first.first&&re[i].first.second>re[j].first.second){
swap(re[i],re[j]);
}
if(re[i].first.first == re[j].first.first&&re[i].first.second==re[j].first.second){
if(re[i].second>re[j].second){
swap(re[i],re[j]);
}
}
}
}
int sc = 0;
cout << re[0].second << ' ' << re[0].first.first << ' ' << re[0].first.second << endl;
for(int i=1;i<re.size();i++){
if(i>3 && (re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second)) break;
if(re[i].first.first!=re[i-1].first.first||re[i].first.second!=re[i-1].first.second) sc++;
if(sc==3) break;
if(re[i].first.first!=0) cout << re[i].second << ' ' << re[i].first.first << ' ' << re[i].first.second << endl;
}
} |
# 2069834, 2024-11-02 11:28:45, --------------------- (0%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
cout<<time<<endl;
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(auto i = nameteam.begin();i!=nameteam.end();i++){
int x=i-nameteam.begin();
cout<< i->second<<" "<<score[x]<<i->first<<endl;
}
return 0;
} | # 2069836, 2024-11-02 11:29:05, --------------------- (0%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
cout<<time<<endl;
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(auto i = nameteam.begin();i!=nameteam.end();i++){
int x=i-nameteam.begin();
cout<< i->second<<" "<<score[x]<<i->first<<endl;
}
return 0;
} | # 2069862, 2024-11-02 11:30:49, --------------------- (0%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
ss[a]=-1;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(auto i = nameteam.begin();i!=nameteam.end();i++){
int x=i-nameteam.begin();
cout<< i->second<<" "<<score[x]<<i->first<<endl;
}
return 0;
} | # 2069875, 2024-11-02 11:31:35, PPPPP---P------------ (28%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
ss[a]=-1;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(auto i = nameteam.begin();i!=nameteam.end();i++){
int x=i-nameteam.begin();
cout<< i->second<<" "<<score[x]<<" "<<i->first<<endl;
}
return 0;
} | # 2069975, 2024-11-02 11:42:05, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
vector<pair<int,pair<int,string>>> asd;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
ss[a]=-1;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(int i=0;i<score.size();i++){
asd.push_back(make_pair(-score[i],make_pair(nameteam[i].first,nameteam[i].second)));
}
sort(asd.begin(),asd.end());
int q=0,w=0;
for(int i = 0;i<asd.size();i++){
if(i>2){
if(q==asd[i].first&&w==asd[i].second.first){
cout<<asd[i].second.second<<" "<<-asd[i].first<<" "<<
asd[i].second.first<<endl;
}
}else{
cout<<asd[i].second.second<<" "<<-asd[i].first<<" "<<
asd[i].second.first<<endl;
}
q=asd[i].first;
w=asd[i].second.first;
}
return 0;
} | # 2069994, 2024-11-02 11:43:38, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
int main(){
int n;
int time ,qwer;
string team,answer;
map<string,int> ss;
vector<pair<int,string>> nameteam;
vector<int> score;
vector<pair<int,pair<int,string>>> asd;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>qwer>>answer;
string a = team+to_string(qwer);
auto it= nameteam.end();
for(auto j =nameteam.begin();j!= nameteam.end();j++){
if((*j).second==team){
it = j;
break;
}
}
if(it!=nameteam.end()){
if(answer=="T"){
if(ss[a]!=-1){
(*it).first +=(ss[a]*20)+time;
int x=it-nameteam.begin();
score[x]++;
ss[a]=-1;
}
}else if(answer=="F"){
if(ss[a]!=-1){
ss[a]+=1;
}
}
}else{
if(answer=="T"){
nameteam.push_back(make_pair(time,team));
ss[a]= -1;
score.push_back(1);
}else if(answer=="F"){
ss[a]=1;
nameteam.push_back(make_pair(0,team));
score.push_back(0);
}
}
}
for(int i=0;i<score.size();i++){
asd.push_back(make_pair(-score[i],make_pair(nameteam[i].first,nameteam[i].second)));
}
sort(asd.begin(),asd.end());
int q=0,w=0;
for(int i = 0;i<asd.size();i++){
if(asd[i].first==0){
break;
}
if(i>2){
if(q==asd[i].first&&w==asd[i].second.first){
cout<<asd[i].second.second<<" "<<-asd[i].first<<" "<<
asd[i].second.first<<endl;
}
}else{
cout<<asd[i].second.second<<" "<<-asd[i].first<<" "<<
asd[i].second.first<<endl;
}
q=asd[i].first;
w=asd[i].second.first;
}
return 0;
} |
# 2071499, 2024-11-02 14:42:36, PP--PPP-PP-PP-P------ (47%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string>> resultAndName; //-right , penalty, name
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team){
get<1>(resultAndName[j]) += 20;
}
}
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} | # 2071548, 2024-11-02 14:47:47, PP-PPPPPPP-PP-P----P- (61%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string,set<int>>> resultAndName; //-right , penalty, name,finishedQuestion
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team,{}});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
get<3>(resultAndName[j]).insert(q);
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<1>(resultAndName[j]) += 20;
}
}
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} | # 2071566, 2024-11-02 14:49:28, PP-PPPPPPPPPP-P----P- (66%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string,set<int>>> resultAndName; //-right , penalty, name,finishedQuestion
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team,{}});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
get<3>(resultAndName[j]).insert(q);
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<1>(resultAndName[j]) += 20;
}
}
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) & get<0>(resultAndName[i]) !=0 ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} | # 2071611, 2024-11-02 14:54:53, xxxxxxPPPPPPPPPPPPPP- (66%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string,set<int>>> resultAndName; //-right , penalty, name,finishedQuestion
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team,{}});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
get<3>(resultAndName[j]).insert(q);
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<1>(resultAndName[j]) += 20;
}
}
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) & get<0>(resultAndName[i]) !=0 ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
for(int i=3;get<0>(resultAndName[i])==get<0>(resultAndName[2]) ;i++){
if(get<1>(resultAndName[i])!=get<1>(resultAndName[2]) ) break;
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} | # 2071634, 2024-11-02 14:56:59, PP-PPPPPPPPPPPPPPPPP- (90%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string,set<int>>> resultAndName; //-right , penalty, name,finishedQuestion
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team,{}});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
get<3>(resultAndName[j]).insert(q);
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<1>(resultAndName[j]) += 20;
}
}
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) & get<0>(resultAndName[i]) !=0 ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
for(int i=3;get<0>(resultAndName[i])==get<0>(resultAndName[2]) ;i++){
if(get<1>(resultAndName[i])!=get<1>(resultAndName[2]) ) break;
if(get<0>(resultAndName[i]) ==0) break;
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} | # 2071712, 2024-11-02 15:07:30, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<iostream>
#include<set>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n; cin>>n;
string team; char result;
int minute, q;
vector<tuple<int,int,string,set<int>,vector<int>>> resultAndName; //-right , penalty, name,finishedQuestion,wrongAnswers
vector<string> TeamNames;
set<string> TN;
int w;
bool nameFound;
for(int i=0;i<n;i++){
cin>>minute >> team >> q >> result;
nameFound = false;
if(TN.find(team) == TN.end())
{
TeamNames.push_back(team);
TN.insert(team);
resultAndName.push_back({0,0,team,{},{}});
}
if (result == 'T')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<0>(resultAndName[j]) -= 1;
get<1>(resultAndName[j]) += minute;
get<3>(resultAndName[j]).insert(q);
}
}
}
else if (result == 'F')
{
for(int j=0;j<size(TeamNames);j++){
if(TeamNames[j] == team & (get<3>(resultAndName[j]).find(q)==get<3>(resultAndName[j]).end())){
get<4>(resultAndName[j]).push_back(q);
}
}
}
}
for(int i=0;i<size(TN) ; i++){
for (int e:get<4>(resultAndName[i])){
if(get<3>(resultAndName[i]).find(e) != get<3>(resultAndName[i]).end())
get<1>(resultAndName[i]) += 20;
}
}
sort(resultAndName.begin(), resultAndName.end());
for(int i=0; i<3 & i<size(TN) & get<0>(resultAndName[i]) !=0 ; i++ ){
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
for(int i=3;get<0>(resultAndName[i])==get<0>(resultAndName[2]) ;i++){
if(get<1>(resultAndName[i])!=get<1>(resultAndName[2]) ) break;
if(get<0>(resultAndName[i]) ==0) break;
cout << get<2>(resultAndName[i])<< ' ' << -get<0>(resultAndName[i])<<' ';
cout << get<1>(resultAndName[i])<<endl;
}
} |
# 2071271, 2024-11-02 14:16:27, PPPPPPP-PPPP-P-PP---- (66%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int minute, code;
string team;
char TF;
bool T;
map<string,vector<int>> Finish;
map<string,pair<int,int>> Score;
map<string,map<int,int>> m;
for(int i=0 ; i<n ; i++) {
cin >> minute >> team >> code >> TF;
if(TF == 'T') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f == Finish[team].end()) {
T = true;
}
}
else {
T = false;
}
if(T) {
Finish[team].push_back(code);
auto it = Score.find(team);
if(it == Score.end()) {
Score[team].first = 1;
Score[team].second = minute;
}
else {
Score[team].first++;
Score[team].second += minute;
}
if(m[team][code] != 0) {
Score[team].second += 20 * m[team][code];
}
}
else {
auto it = m.find(team);
if(it == m.end()) {
m[team][code] = 1;
}
else {
m[team][code]++;
}
}
}
vector<tuple<int,int,string>> out;
for(auto & a : Score) {
out.push_back(make_tuple(-a.second.first, a.second.second, a.first));
}
sort(out.begin(), out.end());
for(auto & a : out) {
cout << get<2>(a) << " " << -get<0>(a) << " " << get<1>(a) << endl;
}
} | # 2071589, 2024-11-02 14:52:16, PPPPPPP-PPPPPPPPPP-PP (90%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int minute, code;
string team;
char TF;
bool T;
map<string,vector<int>> Finish;
map<string,pair<int,int>> Score;
map<string,map<int,int>> m;
for(int i=0 ; i<n ; i++) {
cin >> minute >> team >> code >> TF;
if(TF == 'T') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f == Finish[team].end()) {
T = true;
}
}
else {
T = false;
}
if(T) {
Finish[team].push_back(code);
auto it = Score.find(team);
if(it == Score.end()) {
Score[team].first = 1;
Score[team].second = minute;
}
else {
Score[team].first++;
Score[team].second += minute;
}
if(m[team][code] != 0) {
Score[team].second += 20 * m[team][code];
}
}
else {
auto it = m.find(team);
if(it == m.end()) {
m[team][code] = 1;
}
else {
m[team][code]++;
}
}
}
vector<tuple<int,int,string>> out;
vector<pair<int,int>> Rank;
for(auto & a : Score) {
out.push_back(make_tuple(-a.second.first, a.second.second, a.first));
auto fnd = find(Rank.begin(), Rank.end(), make_pair(-a.second.first, a.second.second));
if(fnd == Rank.end()) {
Rank.push_back(make_pair(-a.second.first, a.second.second));
}
}
sort(out.begin(), out.end());
sort(Rank.begin(), Rank.end());
int count = 0;
for(int i=0 ; i<3 ; i++) {
for(auto & a : out) {
if(get<0>(a) == Rank[i].first && get<1>(a) == Rank[i].second) {
count++;
}
}
if(count >= 3) {
break;
}
}
for(int i=0 ; i<count ; i++) {
cout << get<2>(out[i]) << " " << -get<0>(out[i]) << " " << get<1>(out[i]) << endl;
}
} | # 2071623, 2024-11-02 14:56:15, PPPPPPP-PPPPPPPPPP-PP (90%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int minute, code;
string team;
char TF;
bool T;
map<string,vector<int>> Finish;
map<string,pair<int,int>> Score;
map<string,map<int,int>> m;
for(int i=0 ; i<n ; i++) {
cin >> minute >> team >> code >> TF;
if(TF == 'T') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f == Finish[team].end()) {
T = true;
}
}
else {
T = false;
}
if(T) {
Finish[team].push_back(code);
auto it = Score.find(team);
if(it == Score.end()) {
Score[team].first = 1;
Score[team].second = minute;
}
else {
Score[team].first++;
Score[team].second += minute;
}
auto x = m[team].find(code);
if(x != m[team].end()) {
Score[team].second += 20 * m[team][code];
}
}
else {
auto it = m.find(team);
if(it == m.end()) {
m[team][code] = 1;
}
else {
m[team][code]++;
}
}
}
vector<tuple<int,int,string>> out;
vector<pair<int,int>> Rank;
for(auto & a : Score) {
out.push_back(make_tuple(-a.second.first, a.second.second, a.first));
auto fnd = find(Rank.begin(), Rank.end(), make_pair(-a.second.first, a.second.second));
if(fnd == Rank.end()) {
Rank.push_back(make_pair(-a.second.first, a.second.second));
}
}
sort(out.begin(), out.end());
sort(Rank.begin(), Rank.end());
int count = 0;
for(int i=0 ; i<3 ; i++) {
for(auto & a : out) {
if(get<0>(a) == Rank[i].first && get<1>(a) == Rank[i].second) {
count++;
}
}
if(count >= 3) {
break;
}
}
for(int i=0 ; i<count ; i++) {
cout << get<2>(out[i]) << " " << -get<0>(out[i]) << " " << get<1>(out[i]) << endl;
}
} | # 2071653, 2024-11-02 14:59:47, PPPPPPP-PPPPPPPPPP--- (80%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int minute, code;
string team;
char TF;
bool T = false;
map<string,vector<int>> Finish;
map<string,pair<int,int>> Score;
map<string,map<int,int>> m;
for(int i=0 ; i<n ; i++) {
cin >> minute >> team >> code >> TF;
if(TF == 'T') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f == Finish[team].end()) {
T = true;
}
}
else if(TF == 'F') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f != Finish[team].end()) {
continue;
}
T = false;
}
if(T) {
Finish[team].push_back(code);
auto it = Score.find(team);
if(it == Score.end()) {
Score[team].first = 1;
Score[team].second = minute;
}
else {
Score[team].first++;
Score[team].second += minute;
}
auto x = m[team].find(code);
if(x != m[team].end()) {
Score[team].second += 20 * m[team][code];
}
}
else {
auto it = m.find(team);
if(it == m.end()) {
m[team][code] = 1;
}
else {
m[team][code]++;
}
}
}
vector<tuple<int,int,string>> out;
vector<pair<int,int>> Rank;
for(auto & a : Score) {
out.push_back(make_tuple(-a.second.first, a.second.second, a.first));
auto fnd = find(Rank.begin(), Rank.end(), make_pair(-a.second.first, a.second.second));
if(fnd == Rank.end()) {
Rank.push_back(make_pair(-a.second.first, a.second.second));
}
}
sort(out.begin(), out.end());
sort(Rank.begin(), Rank.end());
int count = 0;
for(int i=0 ; i<3 ; i++) {
for(auto & a : out) {
if(get<0>(a) == Rank[i].first && get<1>(a) == Rank[i].second) {
count++;
}
}
if(count >= 3) {
break;
}
}
for(int i=0 ; i<count ; i++) {
cout << get<2>(out[i]) << " " << -get<0>(out[i]) << " " << get<1>(out[i]) << endl;
}
} | # 2071700, 2024-11-02 15:06:01, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int minute, code;
string team;
char TF;
bool T = false;
map<string,vector<int>> Finish;
map<string,pair<int,int>> Score;
map<string,map<int,int>> m;
for(int i=0 ; i<n ; i++) {
cin >> minute >> team >> code >> TF;
if(TF == 'T') {
auto f = find(Finish[team].begin(), Finish[team].end(), code);
if(f == Finish[team].end()) {
Finish[team].push_back(code);
T = true;
}
else {
continue;
}
}
else {
T = false;
}
if(T) {
auto it = Score.find(team);
if(it == Score.end()) {
Score[team].first = 1;
Score[team].second = minute;
}
else {
Score[team].first++;
Score[team].second += minute;
}
auto x = m[team].find(code);
if(x != m[team].end()) {
Score[team].second += 20 * m[team][code];
}
}
else {
auto it = m.find(team);
if(it == m.end()) {
m[team][code] = 1;
}
else {
m[team][code]++;
}
}
}
vector<tuple<int,int,string>> out;
vector<pair<int,int>> Rank;
for(auto & a : Score) {
out.push_back(make_tuple(-a.second.first, a.second.second, a.first));
auto fnd = find(Rank.begin(), Rank.end(), make_pair(-a.second.first, a.second.second));
if(fnd == Rank.end()) {
Rank.push_back(make_pair(-a.second.first, a.second.second));
}
}
sort(out.begin(), out.end());
sort(Rank.begin(), Rank.end());
int count = 0;
for(int i=0 ; i<3 ; i++) {
for(auto & a : out) {
if(get<0>(a) == Rank[i].first && get<1>(a) == Rank[i].second) {
count++;
}
}
if(count >= 3) {
break;
}
}
for(int i=0 ; i<count ; i++) {
cout << get<2>(out[i]) << " " << -get<0>(out[i]) << " " << get<1>(out[i]) << endl;
}
} |
# 2070865, 2024-11-02 13:26:06, PPPPPPPPPPPPPPPP----- (76%)
#include<bits/stdc++.h>
using namespace std;
bool customComparator(tuple<string, int, int> t1, tuple<string, int, int> t2) {
if(get<1> (t1) != get<1> (t2)) return get<1> (t1) > get<1> (t2);
return get<2> (t1) < get<2> (t2);
}
int main() {
map<pair<string, int>, bool> lis;
map<pair<string, int>, int> tumdai;
map<string, int > penalty, point;
map<int, int> tumpid;
set<string> name;
int n; cin>> n;
int min, pro;
string team;
char ans;
for(int i = 0; i < n; i++) {
cin >> min >> team >> pro >> ans;
name.insert(team);
if(lis[{team, pro}] == false) {
if(ans == 'F') tumpid[pro]++;
else if(ans == 'T') {
lis[{team, pro}] = true;
penalty[team] += min;
tumdai[{team, pro}] = 1;
point[team]++;
}
}
}
for(auto e: tumdai) if(e.second == 1) penalty[e.first.first] += 20*tumpid[e.first.second];
vector<tuple<string, int, int>> t;
for(auto e: name) {
if(point[e] > 0)t.push_back({e, point[e], penalty[e]});
}
sort(t.begin(), t.end(), customComparator);
int count = 1, check1, check2;
for(auto e: t) {
if(count > 3 && (get<1> (e) != check1 || get<2> (e) != check2)) break;
cout << get<0> (e) << ' ' << get<1> (e) << ' ' << get<2> (e) << endl;
count++;
if(count == 4) {
check1 = get<1> (e);
check2 = get<2> (e);
}
}
} | # 2071541, 2024-11-02 14:47:01, --------------------- (0%)
#include<iostream>
using namespace std;
int main() {
cout << "D 3 340" << endl << "B 2 80" << endl << "K 1 52";
} | # 2071642, 2024-11-02 14:58:10, --------------------- (0%)
#include<iostream>
using namespace std;
int main() {
cout << "D 3 280" << endl << "B 2 40" << endl << "K 1 52" << endl << "J 1 52";
} | # 2071648, 2024-11-02 14:59:02, --------------------P (4%)
#include<iostream>
using namespace std;
int main() {
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl << "K 1 52";
} | # 2071691, 2024-11-02 15:04:58, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
bool customComparator(tuple<string, int, int> t1, tuple<string, int, int> t2) {
if(get<1> (t1) != get<1> (t2)) return get<1> (t1) > get<1> (t2);
if(get<2> (t1) != get<2> (t2))return get<2> (t1) < get<2> (t2);
return get<0> (t1) < get<0> (t2);
}
int main() {
map<pair<string, int>, bool> lis;
map<pair<string, int>, int> tumdai, tumpid;
map<string, int > penalty, point;
set<string> name;
int n; cin>> n;
int min, pro;
string team;
char ans;
for(int i = 0; i < n; i++) {
cin >> min >> team >> pro >> ans;
name.insert(team);
if(lis[{team, pro}] == false) {
if(ans == 'F') tumpid[{team,pro}]++;
else if(ans == 'T') {
lis[{team, pro}] = true;
penalty[team] += min;
tumdai[{team, pro}] = 1;
point[team]++;
}
}
}
for(auto e: tumdai) if(e.second == 1) penalty[e.first.first] += 20*tumpid[e.first];
vector<tuple<string, int, int>> t;
for(auto e: name) {
if(point[e] > 0)t.push_back({e, point[e], penalty[e]});
}
sort(t.begin(), t.end(), customComparator);
int count = 1, check1, check2;
for(auto e: t) {
if(count > 3 && (get<1> (e) != check1 || get<2> (e) != check2)) break;
cout << get<0> (e) << ' ' << get<1> (e) << ' ' << get<2> (e) << endl;
count++;
if(count == 4) {
check1 = get<1> (e);
check2 = get<2> (e);
}
}
} |
# 2069876, 2024-11-02 11:31:52, PPPPPP--P-P-P-------- (42%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map < pair<string,int> , tuple<bool,int, int> > m;
int n;
cin >> n;
while(n--){
int time, prob;
string team;
char result;
cin >> time >> team >> prob >> result;
if(m.find({team, prob}) == m.end()) {
get<0>(m[{team, prob}]) = 0;
get<1>(m[{team, prob}]) = 0;
get<2>(m[{team, prob}]) = 0;
}
if(result == 'F'){
if(get<0>(m[{team, prob}]) == 0){
get<1>(m[{team, prob}])++;
}
}
if(result == 'T'){
get<0>(m[{team, prob}]) = 1;
get<2>(m[{team, prob}]) = time;
}
}
map <string, tuple<int, int,int> > l;
for(auto &kv : m){
if(l.find(kv.first.first) == l.end()){
get<0>(l[kv.first.first]) = 0;
get<1>(l[kv.first.first]) = 0;
get<2>(l[kv.first.first]) = 0;
}
if(get<0>(kv.second) == 1){
get<0>(l[kv.first.first]) += get<2>(kv.second);
get<1>(l[kv.first.first]) += get<1>(kv.second);
get<2>(l[kv.first.first])++;
}
}
vector <tuple <int, int, string>> v;
for(auto &kv : l){
int penalty = get<0>(kv.second) + 20*get<1>(kv.second);
if(get<2>(kv.second) > 0)v.push_back(make_tuple( get<2>(kv.second), penalty, kv.first));
}
sort(v.begin(), v.end());
if(v.size() >= 3){
for(int i=0; i<3; i++){
if(get<0>(v[i]) > 0){
cout << get<2>(v[i]) << ' ' << get<0>(v[i]) << ' ' << get<1>(v[i]) << endl;
}
}
}
else{
for(auto i:v){
cout << get<2>(i) << ' ' << get<0>(i) << ' ' << get<1>(i) << endl;
}
}
return 0;
} | # 2069945, 2024-11-02 11:39:04, PPPPPPP-PPPxPPPPP---- (71%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map < pair<string,int> , tuple<bool,int, int> > m;
int n;
cin >> n;
while(n--){
int time, prob;
string team;
char result;
cin >> time >> team >> prob >> result;
if(m.find({team, prob}) == m.end()) {
get<0>(m[{team, prob}]) = 0;
get<1>(m[{team, prob}]) = 0;
get<2>(m[{team, prob}]) = 0;
}
if(result == 'F'){
if(get<0>(m[{team, prob}]) == 0){
get<1>(m[{team, prob}])++;
}
}
if(result == 'T'){
get<0>(m[{team, prob}]) = 1;
get<2>(m[{team, prob}]) = time;
}
}
map <string, tuple<int, int,int> > l;
for(auto &kv : m){
if(l.find(kv.first.first) == l.end()){
get<0>(l[kv.first.first]) = 0;
get<1>(l[kv.first.first]) = 0;
get<2>(l[kv.first.first]) = 0;
}
if(get<0>(kv.second) == 1){
get<0>(l[kv.first.first]) += get<2>(kv.second);
get<1>(l[kv.first.first]) += get<1>(kv.second);
get<2>(l[kv.first.first])++;
}
}
vector <tuple <int, int, string>> v;
for(auto &kv : l){
int penalty = get<0>(kv.second) + 20*get<1>(kv.second);
if(get<2>(kv.second) > 0)v.push_back(make_tuple(-1* get<2>(kv.second), penalty, kv.first));
}
sort(v.begin(), v.end());
int q = 3;
if(v.size() >=3){
for(int i=0; i<q; i++){
if(get<0>(v[i]) == get<0>(v[i+1]) && get<1>(v[i]) == get<1>(v[i+1])) q++;
if(get<0>(v[i])*-1 > 0){
cout << get<2>(v[i]) << ' ' << -1*get<0>(v[i]) << ' ' << get<1>(v[i]) << endl;
}
}
}
else{
for(auto i:v){
cout << get<2>(i) << ' ' << -1*get<0>(i) << ' ' << get<1>(i) << endl;
}
}
return 0;
} | # 2070023, 2024-11-02 11:45:28, PPPPPPPPPPPxPPPPP--PP (85%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map < pair<string,int> , tuple<bool,int, int> > m;
int n;
cin >> n;
while(n--){
int time, prob;
string team;
char result;
cin >> time >> team >> prob >> result;
if(m.find({team, prob}) == m.end()) {
get<0>(m[{team, prob}]) = 0;
get<1>(m[{team, prob}]) = 0;
get<2>(m[{team, prob}]) = 0;
}
if(result == 'F'){
if(get<0>(m[{team, prob}]) == 0){
get<1>(m[{team, prob}])++;
}
}
if(result == 'T'){
if(get<0>(m[{team, prob}]) == 0){
get<0>(m[{team, prob}]) = 1;
get<2>(m[{team, prob}]) = time;
}
}
}
map <string, tuple<int, int,int> > l;
for(auto &kv : m){
if(l.find(kv.first.first) == l.end()){
get<0>(l[kv.first.first]) = 0;
get<1>(l[kv.first.first]) = 0;
get<2>(l[kv.first.first]) = 0;
}
if(get<0>(kv.second) == 1){
get<0>(l[kv.first.first]) += get<2>(kv.second);
get<1>(l[kv.first.first]) += get<1>(kv.second);
get<2>(l[kv.first.first])++;
}
}
vector <tuple <int, int, string>> v;
for(auto &kv : l){
int penalty = get<0>(kv.second) + 20*get<1>(kv.second);
if(get<2>(kv.second) > 0)v.push_back(make_tuple(-1* get<2>(kv.second), penalty, kv.first));
}
sort(v.begin(), v.end());
int q = 3;
if(v.size() >=3){
for(int i=0; i<q; i++){
if(get<0>(v[i]) == get<0>(v[i+1]) && get<1>(v[i]) == get<1>(v[i+1])) q++;
if(get<0>(v[i])*-1 > 0){
cout << get<2>(v[i]) << ' ' << -1*get<0>(v[i]) << ' ' << get<1>(v[i]) << endl;
}
}
}
else{
for(auto i:v){
cout << get<2>(i) << ' ' << -1*get<0>(i) << ' ' << get<1>(i) << endl;
}
}
return 0;
} | # 2070056, 2024-11-02 11:47:52, PPPPPPPPPPPPPPPPP--PP (90%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map < pair<string,int> , tuple<bool,int, int> > m;
int n;
cin >> n;
while(n--){
int time, prob;
string team;
char result;
cin >> time >> team >> prob >> result;
if(m.find({team, prob}) == m.end()) {
get<0>(m[{team, prob}]) = 0;
get<1>(m[{team, prob}]) = 0;
get<2>(m[{team, prob}]) = 0;
}
if(result == 'F'){
if(get<0>(m[{team, prob}]) == 0){
get<1>(m[{team, prob}])++;
}
}
if(result == 'T'){
if(get<0>(m[{team, prob}]) == 0){
get<0>(m[{team, prob}]) = 1;
get<2>(m[{team, prob}]) = time;
}
}
}
map <string, tuple<int, int,int> > l;
for(auto &kv : m){
if(l.find(kv.first.first) == l.end()){
get<0>(l[kv.first.first]) = 0;
get<1>(l[kv.first.first]) = 0;
get<2>(l[kv.first.first]) = 0;
}
if(get<0>(kv.second) == 1){
get<0>(l[kv.first.first]) += get<2>(kv.second);
get<1>(l[kv.first.first]) += get<1>(kv.second);
get<2>(l[kv.first.first])++;
}
}
vector <tuple <int, int, string>> v;
for(auto &kv : l){
int penalty = get<0>(kv.second) + 20*get<1>(kv.second);
if(get<2>(kv.second) > 0)v.push_back(make_tuple(-1* get<2>(kv.second), penalty, kv.first));
}
sort(v.begin(), v.end());
int q = 3;
if(v.size() >=3){
for(int i=0; i<q; i++){
if(get<0>(v[i]) == get<0>(v[i+1]) && get<1>(v[i]) == get<1>(v[i+1]) && get<0>(v[i])*-1 > 0) q++;
if(get<0>(v[i])*-1 > 0){
cout << get<2>(v[i]) << ' ' << -1*get<0>(v[i]) << ' ' << get<1>(v[i]) << endl;
}
}
}
else{
for(auto i:v){
cout << get<2>(i) << ' ' << -1*get<0>(i) << ' ' << get<1>(i) << endl;
}
}
return 0;
} | # 2070160, 2024-11-02 11:54:50, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map < pair<string,int> , tuple<bool,int, int> > m;
int n;
cin >> n;
while(n--){
int time, prob;
string team;
char result;
cin >> time >> team >> prob >> result;
if(m.find({team, prob}) == m.end()) {
get<0>(m[{team, prob}]) = 0;
get<1>(m[{team, prob}]) = 0;
get<2>(m[{team, prob}]) = 0;
}
if(result == 'F'){
if(get<0>(m[{team, prob}]) == 0){
get<1>(m[{team, prob}])++;
}
}
if(result == 'T'){
if(get<0>(m[{team, prob}]) == 0){
get<0>(m[{team, prob}]) = 1;
get<2>(m[{team, prob}]) = time;
}
}
}
map <string, tuple<int, int,int> > l;
for(auto &kv : m){
if(l.find(kv.first.first) == l.end()){
get<0>(l[kv.first.first]) = 0;
get<1>(l[kv.first.first]) = 0;
get<2>(l[kv.first.first]) = 0;
}
if(get<0>(kv.second) == 1){
get<0>(l[kv.first.first]) += get<2>(kv.second);
get<1>(l[kv.first.first]) += get<1>(kv.second);
get<2>(l[kv.first.first])++;
}
}
vector <tuple <int, int, string>> v;
for(auto &kv : l){
int penalty = get<0>(kv.second) + 20*get<1>(kv.second);
if(get<2>(kv.second) > 0)v.push_back(make_tuple(-1* get<2>(kv.second), penalty, kv.first));
}
sort(v.begin(), v.end());
int q = 3;
if(v.size() >=3){
for(int i=0; i<q; i++){
if(get<0>(v[i]) == get<0>(v[i+1]) && get<1>(v[i]) == get<1>(v[i+1]) && get<0>(v[i])*-1 > 0 && i >= 2) q++;
if(get<0>(v[i])*-1 > 0){
cout << get<2>(v[i]) << ' ' << -1*get<0>(v[i]) << ' ' << get<1>(v[i]) << endl;
}
}
}
else{
for(auto i:v){
cout << get<2>(i) << ' ' << -1*get<0>(i) << ' ' << get<1>(i) << endl;
}
}
return 0;
} |
# 2069674, 2024-11-02 11:11:33, PPPP-P---P----------- (28%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<string>> contest(N);
map<string,pair<int,int>> out;
vector<pair<string,string>> done;
map<pair<string,int> ,int> penalty;
for (int i =0;i < N;i++) {
string time,num, name,ans;
cin>>time>>name>>num>>ans;
contest[i].push_back(time);
contest[i].push_back(name);
contest[i].push_back(num);
contest[i].push_back(ans);
}
for (int i = 0 ;i < N; i++) {
pair temp = make_pair(contest[i][1], contest[i][2]);
auto temppen = make_pair(contest[i][1], stoi(contest[i][2]));
if (contest[i][3] == "T" && find(done.begin(),done.end(),temp) == done.end()) {
out[contest[i][1]].first++;
out[contest[i][1]].second += stoi(contest[i][0]) + penalty[temppen];
done.push_back(temp);
}
else if (contest[i][3] == "F" && find(done.begin(),done.end(),temp) == done.end()) {
penalty[temppen] += 20;
}
}
for (auto a : out) {
cout << a.first << " "<< a.second.first <<" "<< a.second.second << endl;
}
} | # 2069890, 2024-11-02 11:33:48, --------P------------ (4%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<string>> contest(N);
map<string,pair<int,int>> out;
vector<pair<string,string>> done;
map<pair<string,int> ,int> penalty;
for (int i =0;i < N;i++) {
string time,num, name,ans;
cin>>time>>name>>num>>ans;
contest[i].push_back(time);
contest[i].push_back(name);
contest[i].push_back(num);
contest[i].push_back(ans);
}
for (int i = 0 ;i < N; i++) {
pair temp = make_pair(contest[i][1], contest[i][2]);
auto temppen = make_pair(contest[i][1], stoi(contest[i][2]));
if (contest[i][3] == "T" && find(done.begin(),done.end(),temp) == done.end()) {
out[contest[i][1]].first++;
out[contest[i][1]].second += stoi(contest[i][0]) + penalty[temppen];
done.push_back(temp);
}
else if (contest[i][3] == "F" && find(done.begin(),done.end(),temp) == done.end()) {
penalty[temppen] += 20;
}
}
vector<vector<string>> finish(N);
int mod = 0;
for (auto a : out) {
//cout << a.first << " "<< a.second.first <<" "<< a.second.second << endl;
finish[mod].push_back(a.first);
finish[mod].push_back(to_string(a.second.first));
finish[mod].push_back(to_string(a.second.second));
mod++;
}
for (int i = 0; i < 3 || i < mod;i++) {
int pos = 0, score = 0, tout = 100000000;
//cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) > score && stoi(finish[j][2]) < tout && finish[j][3] != "X") {
pos = j;
}
}
finish[pos].push_back("X");
cout << finish[pos][0] << " " << finish[pos][1] << " " << finish[pos][2] << endl;
}
} | # 2069996, 2024-11-02 11:43:44, PPPPP---PPP-P-------- (42%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<string>> contest(N);
map<string,pair<int,int>> out;
vector<pair<string,string>> done;
map<pair<string,int> ,int> penalty;
for (int i =0;i < N;i++) {
string time,num, name,ans;
cin>>time>>name>>num>>ans;
contest[i].push_back(time);
contest[i].push_back(name);
contest[i].push_back(num);
contest[i].push_back(ans);
}
for (int i = 0 ;i < N; i++) {
pair temp = make_pair(contest[i][1], contest[i][2]);
auto temppen = make_pair(contest[i][1], stoi(contest[i][2]));
if (contest[i][3] == "T" && find(done.begin(),done.end(),temp) == done.end()) {
out[contest[i][1]].first++;
out[contest[i][1]].second += stoi(contest[i][0]) + penalty[temppen];
done.push_back(temp);
}
else if (contest[i][3] == "F" && find(done.begin(),done.end(),temp) == done.end()) {
penalty[temppen] += 20;
}
}
vector<vector<string>> finish(N);
int mod = 0;
for (auto a : out) {
//cout << a.first << " "<< a.second.first <<" "<< a.second.second << endl;
finish[mod].push_back(a.first);
finish[mod].push_back(to_string(a.second.first));
finish[mod].push_back(to_string(a.second.second));
mod++;
}
for (int i = 0; i < 3 && i < mod;i++) {
int pos = 0, mostscore = 0, leasttout = 100000000;
//cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) >= mostscore && finish[j][3] != "X" && stoi(finish[j][2]) < leasttout) {
mostscore = stoi(finish[j][1]);
leasttout = stoi(finish[j][2]);
}
}
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) == mostscore && stoi(finish[j][2]) == leasttout) {
pos = j;
break;
}
}
finish[pos].push_back("X");
cout << finish[pos][0] << " " << finish[pos][1] << " " << finish[pos][2] << endl;
}
} | # 2070091, 2024-11-02 11:49:56, PPPPPP--PPP-PP------- (52%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<string>> contest(N);
map<string,pair<int,int>> out;
vector<pair<string,string>> done;
map<pair<string,int> ,int> penalty;
for (int i =0;i < N;i++) {
string time,num, name,ans;
cin>>time>>name>>num>>ans;
contest[i].push_back(time);
contest[i].push_back(name);
contest[i].push_back(num);
contest[i].push_back(ans);
}
for (int i = 0 ;i < N; i++) {
pair temp = make_pair(contest[i][1], contest[i][2]);
auto temppen = make_pair(contest[i][1], stoi(contest[i][2]));
if (contest[i][3] == "T" && find(done.begin(),done.end(),temp) == done.end()) {
out[contest[i][1]].first++;
out[contest[i][1]].second += stoi(contest[i][0]) + penalty[temppen];
done.push_back(temp);
}
else if (contest[i][3] == "F" && find(done.begin(),done.end(),temp) == done.end()) {
penalty[temppen] += 20;
}
}
vector<vector<string>> finish(N);
int mod = 0;
for (auto a : out) {
//cout << a.first << " "<< a.second.first <<" "<< a.second.second << endl;
finish[mod].push_back(a.first);
finish[mod].push_back(to_string(a.second.first));
finish[mod].push_back(to_string(a.second.second));
mod++;
}
int lastscore = 0;
for (int i = 0; i < 3 && i < mod;i++) {
int pos = 0, mostscore = 0, leasttout = 100000000;
//cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) >= mostscore && finish[j][3] != "X" && stoi(finish[j][2]) < leasttout) {
mostscore = stoi(finish[j][1]);
leasttout = stoi(finish[j][2]);
}
}
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) == mostscore && stoi(finish[j][2]) == leasttout && finish[j][3] != "X") {
pos = j;
break;
}
}
finish[pos].push_back("X");
cout << finish[pos][0] << " " << finish[pos][1] << " " << finish[pos][2] << endl;
lastscore = stoi(finish[pos][2]);
}
while (true) {
for (int i =0 ;i < mod; i++) {
if (stoi(finish[i][2]) == lastscore && finish[i][3] != "X") {
cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
continue;
}
}
break;
}
} | # 2070164, 2024-11-02 11:55:05, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<vector<string>> contest(N);
map<string,pair<int,int>> out;
vector<pair<string,string>> done;
map<pair<string,int> ,int> penalty;
for (int i =0;i < N;i++) {
string time,num, name,ans;
cin>>time>>name>>num>>ans;
contest[i].push_back(time);
contest[i].push_back(name);
contest[i].push_back(num);
contest[i].push_back(ans);
}
for (int i = 0 ;i < N; i++) {
pair temp = make_pair(contest[i][1], contest[i][2]);
auto temppen = make_pair(contest[i][1], stoi(contest[i][2]));
if (contest[i][3] == "T" && find(done.begin(),done.end(),temp) == done.end()) {
out[contest[i][1]].first++;
out[contest[i][1]].second += stoi(contest[i][0]) + penalty[temppen];
done.push_back(temp);
}
else if (contest[i][3] == "F" && find(done.begin(),done.end(),temp) == done.end()) {
penalty[temppen] += 20;
}
}
vector<vector<string>> finish(N);
int mod = 0;
for (auto a : out) {
//cout << a.first << " "<< a.second.first <<" "<< a.second.second << endl;
finish[mod].push_back(a.first);
finish[mod].push_back(to_string(a.second.first));
finish[mod].push_back(to_string(a.second.second));
mod++;
}
int lastscore = 0;
for (int i = 0; i < 3 && i < mod;i++) {
int pos = 0, mostscore = 0, leasttout = 100000000;
//cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) > mostscore && finish[j][3] != "X") {
mostscore = stoi(finish[j][1]);
leasttout = stoi(finish[j][2]);
}
else if (stoi(finish[j][1]) == mostscore && finish[j][3] != "X" && stoi(finish[j][2]) < leasttout) {
mostscore = stoi(finish[j][1]);
leasttout = stoi(finish[j][2]);
}
}
for (int j = 0; j < mod; j++) {
if (stoi(finish[j][1]) == mostscore && stoi(finish[j][2]) == leasttout && finish[j][3] != "X") {
pos = j;
break;
}
}
finish[pos].push_back("X");
cout << finish[pos][0] << " " << finish[pos][1] << " " << finish[pos][2] << endl;
lastscore = stoi(finish[pos][2]);
}
while (true) {
for (int i =0 ;i < mod; i++) {
if (stoi(finish[i][2]) == lastscore && finish[i][3] != "X") {
cout << finish[i][0] << " " << finish[i][1] << " " << finish[i][2] << endl;
continue;
}
}
break;
}
} |
# 2071305, 2024-11-02 14:21:01, PPPP-PPP-P-P---PP---- (52%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t,problem;
string team,result;
map<string,set<int>> True;
map<string,multiset<int>> False;
map<string,int>Time;
int num_problem=0;
for(int i = 0;i < n;i++){
cin >> t >> team >> problem >> result;
if(problem > num_problem)num_problem = problem;
if(!Time.count(team))Time[team]=0;
if(result == "T"&&!True[team].count(problem)){
True[team].insert(problem);
Time[team]+=t;
}
else if(!True[team].count(problem))False[team].insert(problem);
}
for(auto x : False){
for(auto a : x.second){
if(True[x.first].count(a))Time[x.first]+=20;
}
}
int c = 0;
for(int i = num_problem;i >0;i--){
for(auto x : True){
if(x.second.size()==i){
cout << x.first << " " << i << " " << Time[x.first]<<endl;
c++;
}
}
}
return 0;
} | # 2071355, 2024-11-02 14:26:14, PPPP-PPP-P-P--P------ (47%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t,problem;
string team,result;
map<string,set<int>> True;
map<string,multiset<int>> False;
map<string,int>Time;
int num_problem=0;
for(int i = 0;i < n;i++){
cin >> t >> team >> problem >> result;
if(problem > num_problem)num_problem = problem;
if(!Time.count(team))Time[team]=0;
if(result == "T"&&!True[team].count(problem)){
True[team].insert(problem);
Time[team]+=t;
}
else if(!True[team].count(problem))False[team].insert(problem);
}
for(auto x : False){
for(auto a : x.second){
if(True[x.first].count(a))Time[x.first]+=20;
}
}
int c = 0;
for(int i = num_problem;i >0;i--){
for(auto x : True){
if(x.second.size()==i){
cout << x.first << " " << i << " " << Time[x.first]<<endl;
c++;
if(c == 3)return 0;
}
}
}
return 0;
} | # 2071356, 2024-11-02 14:26:32, PPPP-PPP-P-P---PP---- (52%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t,problem;
string team,result;
map<string,set<int>> True;
map<string,multiset<int>> False;
map<string,int>Time;
int num_problem=0;
for(int i = 0;i < n;i++){
cin >> t >> team >> problem >> result;
if(problem > num_problem)num_problem = problem;
if(!Time.count(team))Time[team]=0;
if(result == "T"&&!True[team].count(problem)){
True[team].insert(problem);
Time[team]+=t;
}
else if(!True[team].count(problem))False[team].insert(problem);
}
for(auto x : False){
for(auto a : x.second){
if(True[x.first].count(a))Time[x.first]+=20;
}
}
int c = 0;
for(int i = num_problem;i >0;i--){
for(auto x : True){
if(x.second.size()==i){
cout << x.first << " " << i << " " << Time[x.first]<<endl;
c++;
}
}
}
return 0;
} | # 2071369, 2024-11-02 14:28:24, PPPP-PPP-P-P--PPPPP-- (66%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t,problem;
string team,result;
map<string,set<int>> True;
map<string,multiset<int>> False;
map<string,int>Time;
int num_problem=0;
for(int i = 0;i < n;i++){
cin >> t >> team >> problem >> result;
if(problem > num_problem)num_problem = problem;
if(!Time.count(team))Time[team]=0;
if(result == "T"&&!True[team].count(problem)){
True[team].insert(problem);
Time[team]+=t;
}
else if(!True[team].count(problem))False[team].insert(problem);
}
for(auto x : False){
for(auto a : x.second){
if(True[x.first].count(a))Time[x.first]+=20;
}
}
int c = 0;
for(int i = num_problem;i >0;i--){
if(c>=3)break;
for(auto x : True){
if(x.second.size()==i){
cout << x.first << " " << i << " " << Time[x.first]<<endl;
c++;
}
}
}
return 0;
} | # 2071619, 2024-11-02 14:55:33, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t,problem;
string team,result;
map<string,set<int>> True;
map<string,multiset<int>> False;
map<string,int>Time;
multiset<pair<int,string>>time;
int num_problem=0;
for(int i = 0;i < n;i++){
cin >> t >> team >> problem >> result;
if(problem > num_problem)num_problem = problem;
if(!Time.count(team))Time[team]=0;
if(result == "T"&&!True[team].count(problem)){
True[team].insert(problem);
Time[team]+=t;
}
else if(!True[team].count(problem))False[team].insert(problem);
}
for(auto x : False){
for(auto a : x.second){
if(True[x.first].count(a))Time[x.first]+=20;
}
}
for(auto a : Time){
time.insert(make_pair(a.second,a.first));
}
int c = 0;
for(int i = num_problem;i >0;i--){
if(c >= 3)break;
int temp = INT_MAX;
for(auto x : time){
if(True[x.second].size()==i){
if(c>=3&&x.first>temp)break;
cout << x.second << " " << i << " " << x.first<<endl;
c++;
temp = x.first;
}
}
}
return 0;
} |
# 2071376, 2024-11-02 14:28:54, PP--P-P-PPP-P-P------ (42%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,min,problem;
string team,TF;
map<string,int> teamToScore;
map<string,int> teamToPenalty;
map<int,set<string>> probToTeam;
set<int> allProb;
set<string> allTeam;
tuple<int,string,int> previous;
cin>>n;
///find penalty and score
for(int i=0;i<n;i++){
cin>>min>>team>>problem>>TF;
allTeam.insert(team);
if(probToTeam[problem].find(team)!=probToTeam[problem].end())continue;////////already solved
if(TF=="T"){//////////////correct
teamToScore[team]+=1;
teamToPenalty[team]+=min;
}
else if(TF=="F"){//////////wrong
teamToPenalty[team]+=20;
}
//cout<<team<<" "<<teamToPenalty[team]<<" "<<teamToScore[team]<<endl;///////
}
set<pair<int,int>> winner;
for(auto i:allTeam){
winner.insert(make_pair(-1*teamToScore[i],teamToPenalty[i]));
}
////output
int check=0;
for(auto i:winner){
if(i.first==0)break;
if(check==3)break;
for(auto j:allTeam){
if(teamToPenalty[j]==i.second&&teamToScore[j]==-1*i.first){
cout<<j<<" "<<-1*i.first<<" "<<i.second;
break;
}
}
cout<<endl;
check++;
}
return 0;
} | # 2071656, 2024-11-02 15:00:01, PPPPPPPPPPPP-P-PPPP-P (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,min,problem;
string team,TF;
map<string,int> teamToScore;
map<string,int> teamToPenalty;
map<int,set<string>> probToTeam;
set<int> allProb;
set<string> allTeam;
map<pair<string,int>,int> tried;
tuple<int,string,int> previous;
cin>>n;
//find penalty and score
for(int i=0;i<n;i++){
cin>>min>>team>>problem>>TF;
allTeam.insert(team);
if(probToTeam[problem].find(team)!=probToTeam[problem].end())continue;//lready solved
if(TF=="T"){//////////////correct
teamToScore[team]+=1;
teamToPenalty[team]+=min+20*tried[make_pair(team,problem)];
probToTeam[problem].insert(team);
}
else if(TF=="F"){//////////wrong
tried[make_pair(team,problem)]+=1;
}
//cout<<teamToPenalty[team]<<endl;
}
set<pair<int,int>> winner;
for(auto i:allTeam){
winner.insert(make_pair(-1*teamToScore[i],teamToPenalty[i]));
}
////output
int check=0;
for(auto i:winner){
if(i.first==0)break;
if(check>3)break;
for(auto j:allTeam){
if(teamToPenalty[j]==i.second&&teamToScore[j]==-1*i.first){
cout<<j<<" "<<-1*i.first<<" "<<i.second<<endl;
check++;
}
}
}
return 0;
} | # 2071750, 2024-11-02 15:11:35, PPPPPPPPPPPP-P-PPPP-P (85%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,min,problem;
string team,TF;
map<string,int> teamToScore;
map<string,int> teamToPenalty;
map<int,set<string>> probToTeam;
set<int> allProb;
set<string> allTeam;
map<pair<string,int>,int> tried;
tuple<int,string,int> previous;
cin>>n;
//find penalty and score
for(int i=0;i<n;i++){
cin>>min>>team>>problem>>TF;
allTeam.insert(team);
if(probToTeam[problem].find(team)!=probToTeam[problem].end())continue;//lready solved
if(TF=="T"){//////////////correct
teamToScore[team]+=1;
teamToPenalty[team]+=min+20*tried[make_pair(team,problem)];
tried[make_pair(team,problem)]=0;
probToTeam[problem].insert(team);
}
else if(TF=="F"){//////////wrong
tried[make_pair(team,problem)]+=1;
}
//cout<<teamToPenalty[team]<<endl;
}
set<pair<int,int>> winner;
for(auto i:allTeam){
winner.insert(make_pair(-1*teamToScore[i],teamToPenalty[i]));
}
////output
int check=0;
for(auto i:winner){
if(i.first==0)break;
if(check>3)break;
for(auto j:allTeam){
if(teamToPenalty[j]==i.second&&teamToScore[j]==-1*i.first){
cout<<j<<" "<<-1*i.first<<" "<<i.second<<endl;
check++;
}
}
}
return 0;
} | # 2071879, 2024-11-02 15:24:35, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,min,problem;
string team,TF;
map<string,int> teamToScore;
map<string,int> teamToPenalty;
map<int,set<string>> probToTeam;
set<int> allProb;
set<string> allTeam;
map<pair<string,int>,int> tried;
tuple<int,string,int> previous;
cin>>n;
//find penalty and score
for(int i=0;i<n;i++){
cin>>min>>team>>problem>>TF;
allTeam.insert(team);
if(probToTeam[problem].find(team)!=probToTeam[problem].end())continue;//lready solved
if(TF=="T"){//////////////correct
teamToScore[team]+=1;
teamToPenalty[team]+=min+20*tried[make_pair(team,problem)];
tried[make_pair(team,problem)]=0;
probToTeam[problem].insert(team);
}
else if(TF=="F"){//////////wrong
tried[make_pair(team,problem)]+=1;
}
//cout<<teamToPenalty[team]<<endl;
}
set<pair<int,int>> winner;
for(auto i:allTeam){
winner.insert(make_pair(-1*teamToScore[i],teamToPenalty[i]));
}
////output
int check=0;
for(auto i:winner){
if(i.first==0)break;
if(check>=3)break;
for(auto j:allTeam){
if(teamToPenalty[j]==i.second&&teamToScore[j]==-1*i.first){
cout<<j<<" "<<-1*i.first<<" "<<i.second<<endl;
check++;
}
}
}
return 0;
} |
# 2069334, 2024-11-02 10:37:22, PP-PPPPPPPPPP-P----P- (66%)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
map<string, set<int>> done;
map<string, int> penalty, pass;
set<string> contest;
int n;
cin >> n;
int time, number;
string name, check;
bool z;
for(int i = 0; i < n ; i++){
cin >> time >> name >> number >> check;
contest.insert(name);
z = done[name].find(number) == done[name].end();
//if done first time
if(check == "T" && z){
done[name].insert(number);
pass[name]++;
penalty[name] += time;
}
else if(check == "F" && z) penalty[name] += 20;
}
vector<tuple<int, int, string>> temp;
for(auto n: contest){
temp.push_back(make_tuple(pass[n], penalty[n], n));
}
sort(temp.begin(), temp.end(), [](const tuple<int, int, string> &a, const tuple<int, int, string>& b){
if(get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b);
else if(get<1>(a) != get<1>(b)) return get<1>(a) < get<1>(b);
else return get<2>(a) < get<2>(b);
});
for(int i = 0; i < 3; i++){
if(i >= temp.size() || get<0>(temp[i]) < 1) break;
cout << get<2>(temp[i]) << " " << get<0>(temp[i]) << " " << get<1>(temp[i]) << endl;
}
return 0;
} | # 2069443, 2024-11-02 10:47:18, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
map<string, set<int>> done;
map<string, int> penalty, pass;
set<string> contest;
int n;
cin >> n;
int time, number;
string name, check;
bool z;
for(int i = 0; i < n ; i++){
cin >> time >> name >> number >> check;
contest.insert(name);
z = done[name].find(number) == done[name].end();
//if done first time
if(check == "T" && z){
done[name].insert(number);
pass[name]++;
penalty[name] += time;
}
else if(check == "F" && z) penalty[name] += 20;
}
vector<tuple<int, int, string>> temp;
for(auto n: contest){
temp.push_back(make_tuple(pass[n], penalty[n], n));
}
sort(temp.begin(), temp.end(), [](const tuple<int, int, string> &a, const tuple<int, int, string>& b){
if(get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b);
else if(get<1>(a) != get<1>(b)) return get<1>(a) < get<1>(b);
else return get<2>(a) < get<2>(b);
});
bool forsure = false;
for(int i = 0; i < temp.size(); i++){
if(i > 0) forsure = ( get<1>(temp[i]) == get<1>(temp[i - 1]) && get<0>(temp[i]) == get<0>(temp[i - 1]) );
if((i >= temp.size() || i >= 3 || get<0>(temp[i]) < 1) && !forsure) break;
cout << get<2>(temp[i]) << " " << get<0>(temp[i]) << " " << get<1>(temp[i]) << endl;
forsure = false;
}
return 0;
} | # 2069974, 2024-11-02 11:42:00, --------------------- (0%)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
map<string, set<int>> done;
map<string, int> penalty, pass, penalty_store;
set<string> contest;
int n;
cin >> n;
int time, number;
string name, check;
bool z;
for(int i = 0; i < n ; i++){
cin >> time >> name >> number >> check;
contest.insert(name);
z = (done[name].find(number) == done[name].end());
//if done first time
if(check == "T" && z){
done[name].insert(number);
pass[name]++;
penalty[name] += penalty_store[name];
}
else if(check == "F" && z) {
penalty[name] += 20;
penalty_store[name] += time;
}
}
vector<tuple<int, int, string>> temp;
for(auto n: contest){
temp.push_back(make_tuple(pass[n], penalty[n], n));
}
sort(temp.begin(), temp.end(), [](const tuple<int, int, string> &a, const tuple<int, int, string>& b){
if(get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b);
else if(get<1>(a) != get<1>(b)) return get<1>(a) < get<1>(b);
else return get<2>(a) < get<2>(b);
});
bool forsure = false;
for(int i = 0; i < temp.size(); i++){
if(i > 0) forsure = ( get<1>(temp[i]) == get<1>(temp[i - 1]) && get<0>(temp[i]) == get<0>(temp[i - 1]) );
if((i >= temp.size() || i >= 3 || get<0>(temp[i]) < 1) && !forsure) break;
cout << get<2>(temp[i]) << " " << get<0>(temp[i]) << " " << get<1>(temp[i]) << endl;
forsure = false;
}
return 0;
} | # 2070042, 2024-11-02 11:46:47, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
map<string, set<int>> done;
map<string, int> penalty, pass;
map<string, map<int, int>> penalty_store;
set<string> contest;
int n;
cin >> n;
int time, number;
string name, check;
bool z;
for(int i = 0; i < n ; i++){
cin >> time >> name >> number >> check;
contest.insert(name);
z = (done[name].find(number) == done[name].end());
//if done first time
if(check == "T" && z){
done[name].insert(number);
pass[name]++;
penalty[name] += penalty_store[name][number] + time;
}
else if(check == "F" && z) {
penalty_store[name][number] += 20;
}
}
vector<tuple<int, int, string>> temp;
for(auto n: contest){
temp.push_back(make_tuple(pass[n], penalty[n], n));
}
sort(temp.begin(), temp.end(), [](const tuple<int, int, string> &a, const tuple<int, int, string>& b){
if(get<0>(a) != get<0>(b)) return get<0>(a) > get<0>(b);
else if(get<1>(a) != get<1>(b)) return get<1>(a) < get<1>(b);
else return get<2>(a) < get<2>(b);
});
bool forsure = false;
for(int i = 0; i < temp.size(); i++){
if(i > 0) forsure = ( get<1>(temp[i]) == get<1>(temp[i - 1]) && get<0>(temp[i]) == get<0>(temp[i - 1]) );
if((i >= temp.size() || i >= 3 || get<0>(temp[i]) < 1) && !forsure) break;
cout << get<2>(temp[i]) << " " << get<0>(temp[i]) << " " << get<1>(temp[i]) << endl;
forsure = false;
}
return 0;
} |
# 2069698, 2024-11-02 11:14:52, --------PP--PPPP----- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<int,map<int,set<string>>> winner;
map<string,map<int,int>> penaltytmp;
map<string,set<int>> done;
map<string,int> topiccount;
map<string,int> penaltycount;
set<string> teamlist;
int n; cin >> n;
int time,topic;
string team,result;
for(int i = 0;i<n;i++){
cin >> time;
cin >> team;
cin >> topic;
cin >> result;
teamlist.insert(team);
if(done[team].find(topic)!=done[team].end()) continue; //already done not do anything
else{
penaltytmp[team][topic] += time;
if(result == "T"){
done[team].insert(topic);
topiccount[team]++;
penaltycount[team]+= penaltytmp[team][topic];
}
}
}
for(auto e : teamlist){
winner[topiccount[e]][penaltycount[e]].insert(e);
}
auto itr = winner.end();
itr--;
int countend=0;
while(true){
for(auto e: (*itr).second){
for(auto f : e.second){
cout << f<< " "<<(*itr).first<<" " <<e.first << endl;
countend++;
}
if(countend>=3) break;
}
if(countend>=3) break;
itr--;
}
} | # 2069727, 2024-11-02 11:18:51, P---PPPPPP--PPPP----- (52%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<int,map<int,set<string>>> winner;
map<string,map<int,int>> penaltytmp;
map<string,set<int>> done;
map<string,int> topiccount;
map<string,int> penaltycount;
set<string> teamlist;
int n; cin >> n;
int time,topic;
string team,result;
for(int i = 0;i<n;i++){
cin >> time;
cin >> team;
cin >> topic;
cin >> result;
teamlist.insert(team);
if(done[team].find(topic)!=done[team].end()) continue; //already done not do anything
else{
penaltytmp[team][topic] += time;
if(result == "T"){
done[team].insert(topic);
topiccount[team]++;
penaltycount[team]+= penaltytmp[team][topic];
}
}
}
int size = teamlist.size();
//cout << size << "adas";
for(auto e : teamlist){
winner[topiccount[e]][penaltycount[e]].insert(e);
}
auto itr = winner.end();
itr--;
int countend=0;
while(true){
for(auto e: (*itr).second){
for(auto f : e.second){
cout << f<< " "<<(*itr).first<<" " <<e.first << endl;
countend++;
if(countend>=size) break;
}
if(countend>=3) break;
if(countend>=size) break;
}
if(countend>=3) break;
if(countend>=size) break;
itr--;
}
} | # 2069763, 2024-11-02 11:22:34, P---PPPPPPP-PPPP----- (57%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<int,map<int,set<string>>> winner;
map<string,map<int,int>> penaltytmp;
map<string,set<int>> done;
map<string,int> topiccount;
map<string,int> penaltycount;
set<string> teamlist;
int n; cin >> n;
int time,topic;
string team,result;
for(int i = 0;i<n;i++){
cin >> time;
cin >> team;
cin >> topic;
cin >> result;
teamlist.insert(team);
if(done[team].find(topic)!=done[team].end()) continue; //already done not do anything
else{
penaltytmp[team][topic] += time;
if(result == "T"){
done[team].insert(topic);
topiccount[team]++;
penaltycount[team]+= penaltytmp[team][topic];
}
}
}
int size = teamlist.size();
//cout << size << "adas";
for(auto e : teamlist){
winner[topiccount[e]][penaltycount[e]].insert(e);
}
auto itr = winner.end();
itr--;
int countend=0;
while(true){
for(auto e: (*itr).second){
for(auto f : e.second){
if((*itr).first==0) break;
cout << f<< " "<<(*itr).first<<" " <<e.first << endl;
countend++;
if(countend>=size) break;
}
if(countend>=3) break;
if(countend>=size||(*itr).first==0) break;
}
if(countend>=3) break;
if(countend>=size||(*itr).first==0) break;
itr--;
}
} | # 2069800, 2024-11-02 11:25:41, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<int,map<int,set<string>>> winner;
map<string,map<int,int>> penaltytmp;
map<string,set<int>> done;
map<string,int> topiccount;
map<string,int> penaltycount;
set<string> teamlist;
int n; cin >> n;
int time,topic;
string team,result;
for(int i = 0;i<n;i++){
cin >> time;
cin >> team;
cin >> topic;
cin >> result;
teamlist.insert(team);
if(done[team].find(topic)!=done[team].end()) continue; //already done not do anything
else{
if(result == "T"){
done[team].insert(topic);
topiccount[team]++;
penaltycount[team]+= time + penaltytmp[team][topic];
}
else penaltytmp[team][topic] += 20;
}
}
int size = teamlist.size();
//cout << size << "adas";
for(auto e : teamlist){
winner[topiccount[e]][penaltycount[e]].insert(e);
}
auto itr = winner.end();
itr--;
int countend=0;
while(true){
for(auto e: (*itr).second){
for(auto f : e.second){
if((*itr).first==0) break;
cout << f<< " "<<(*itr).first<<" " <<e.first << endl;
countend++;
if(countend>=size) break;
}
if(countend>=3) break;
if(countend>=size||(*itr).first==0) break;
}
if(countend>=3) break;
if(countend>=size||(*itr).first==0) break;
itr--;
}
} |
# 2071553, 2024-11-02 14:48:13, PPPPPPPPPPPPP-P------ (66%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;
bool cmp(const tuple<string, int, int> &t1, tuple<string, int, int> &t2){
if(get<1>(t1) > get<1>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<2>(t1) < get<2>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2) ) return true;
return false;
}
int main(){
int count; cin >> count;
map<string, map< int,pair<int,bool>>> teams; // team { probs{prob {F, Tyet}} , score , penalty}
map<string , pair<int,int>> teamsscp; // team { score , pen }
while (count--)
{
int time, prob; string t, res;
cin >> time >> t >> prob >> res; // 10 A 1 T
//if(teams.count(team) == 0) teams[team]
if(res == "F"){
teams[t][prob].first += 1;
}
else if(res == "T" && teams[t][prob].second == false){
teams[t][prob].second = true;
int F = teams[t][prob].first;
teamsscp[t].second += F*20+time;
teamsscp[t].first += 1;
}
}
vector<tuple<string, int, int>> order; // team score pen
for(auto p:teamsscp){
order.push_back(make_tuple(p.first, p.second.first, p.second.second));
}
sort(order.begin(), order.end(), cmp);
int thre = 1; pair<int, int> prev;
for(auto t: order){
if(thre != 4)
cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
if((pair<int, int>){get<1>(t), get<2>(t)} == prev) continue;
prev = { get<1>(t), get<2>(t)};
thre++;
}
} | # 2071565, 2024-11-02 14:49:28, PPPPPPPPPPPPP-P------ (66%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;
bool cmp(const tuple<string, int, int> &t1, tuple<string, int, int> &t2){
if(get<1>(t1) > get<1>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<2>(t1) < get<2>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2) ) return true;
return false;
}
int main(){
int count; cin >> count;
map<string, map< int,pair<int,bool>>> teams; // team { probs{prob {F, Tyet}} , score , penalty}
map<string , pair<int,int>> teamsscp; // team { score , pen }
while (count--)
{
int time, prob; string t, res;
cin >> time >> t >> prob >> res; // 10 A 1 T
//if(teams.count(team) == 0) teams[team]
if(res == "F"){
teams[t][prob].first += 1;
}
else if(res == "T" && teams[t][prob].second == false){
teams[t][prob].second = true;
int F = teams[t][prob].first;
teamsscp[t].second += F*20+time;
teamsscp[t].first += 1;
}
}
vector<tuple<string, int, int>> order; // team score pen
for(auto p:teamsscp){
if(p.second.first != 0)order.push_back(make_tuple(p.first, p.second.first, p.second.second));
}
sort(order.begin(), order.end(), cmp);
int thre = 1; pair<int, int> prev;
for(auto t: order){
if(thre != 4)
cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
if((pair<int, int>){get<1>(t), get<2>(t)} == prev) continue;
prev = { get<1>(t), get<2>(t)};
thre++;
}
} | # 2071674, 2024-11-02 15:02:46, PPPPPPPP--P------PP-- (52%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;
bool cmp(const tuple<string, int, int> &t1, tuple<string, int, int> &t2){
if(get<1>(t1) > get<1>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<2>(t1) < get<2>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2) ) return true;
return false;
}
int main(){
int count; cin >> count;
map<string, map< int,pair<int,bool>>> teams; // team { probs{prob {F, Tyet}} , score , penalty}
map<string , pair<int,int>> teamsscp; // team { score , pen }
while (count--)
{
int time, prob; string t, res;
cin >> time >> t >> prob >> res; // 10 A 1 T
//if(teams.count(team) == 0) teams[team]
if(res == "F"){
teams[t][prob].first += 1;
}
else if(res == "T" && teams[t][prob].second == false){
teams[t][prob].second = true;
int F = teams[t][prob].first;
teamsscp[t].second += F*20+time;
teamsscp[t].first += 1;
}
}
vector<tuple<string, int, int>> order; // team score pen
for(auto p:teamsscp){
if(p.second.first != 0)order.push_back(make_tuple(p.first, p.second.first, p.second.second));
}
sort(order.begin(), order.end(), cmp);
int thre = 1; pair<int, int> prev;
for(auto t: order){
if(thre == 3 && (pair<int, int>){get<1>(t), get<2>(t)} != prev) break;
if(thre != 4) cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
if(thre == 3 && (pair<int, int>){get<1>(t), get<2>(t)} == prev) continue;
prev = { get<1>(t), get<2>(t)};
thre++;
}
} | # 2071714, 2024-11-02 15:07:34, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;
bool cmp(const tuple<string, int, int> &t1, tuple<string, int, int> &t2){
if(get<1>(t1) > get<1>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<2>(t1) < get<2>(t2) ) return true;
if(get<1>(t1) == get<1>(t2) && get<0>(t1) < get<0>(t2) ) return true;
return false;
}
int main(){
int count; cin >> count;
map<string, map< int,pair<int,bool>>> teams; // team { probs{prob {F, Tyet}} , score , penalty}
map<string , pair<int,int>> teamsscp; // team { score , pen }
while (count--)
{
int time, prob; string t, res;
cin >> time >> t >> prob >> res; // 10 A 1 T
//if(teams.count(team) == 0) teams[team]
if(res == "F"){
teams[t][prob].first += 1;
}
else if(res == "T" && teams[t][prob].second == false){
teams[t][prob].second = true;
int F = teams[t][prob].first;
teamsscp[t].second += F*20+time;
teamsscp[t].first += 1;
}
}
vector<tuple<string, int, int>> order; // team score pen
for(auto p:teamsscp){
if(p.second.first != 0)order.push_back(make_tuple(p.first, p.second.first, p.second.second));
}
sort(order.begin(), order.end(), cmp);
int thre = 1; pair<int, int> prev;
for(auto t: order){
if(thre == 4 && (pair<int, int>){get<1>(t), get<2>(t)} == prev) {
cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
continue;
}
else if(thre == 4 && (pair<int, int>){get<1>(t), get<2>(t)} != prev) break;
else if(thre != 4) cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << endl;
prev = { get<1>(t), get<2>(t)};
thre++;
}
} |
# 2069482, 2024-11-02 10:51:03, xxxxxxxx--x---------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string,int> penalty,wrong,good;
int num;
map<string,bool> quest;
int min;
string team,check,q;
cin >> num;
for(int i = 0;i<num;i++){
cin >> min >> team >> q >> check;
if(quest[q + team])continue;
else {
if(check == "T"){
penalty[team] += min;
penalty[team] += wrong[q+team];
quest[q+team] = true;
good[team]++;
}
else wrong[q+team] +=20;
}
}
set<tuple<int,int,string>> ans;
for(auto m:good){
ans.insert(make_tuple(m.second,penalty[m.first],m.first));
}
auto beg = ans.begin();
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg);
beg++;
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg);
beg++;
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg);
int now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
int then1 = get<0>(*beg),then2 = get<1>(*beg);
while(now1 == then1 && now2 == then2){
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg);
now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
then1 = get<0>(*beg),then2 = get<1>(*beg);
}
} | # 2069491, 2024-11-02 10:52:03, xxxxxxxxP-x-PP------- (14%)
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string,int> penalty,wrong,good;
int num;
map<string,bool> quest;
int min;
string team,check,q;
cin >> num;
for(int i = 0;i<num;i++){
cin >> min >> team >> q >> check;
if(quest[q + team])continue;
else {
if(check == "T"){
penalty[team] += min;
penalty[team] += wrong[q+team];
quest[q+team] = true;
good[team]++;
}
else wrong[q+team] +=20;
}
}
set<tuple<int,int,string>> ans;
for(auto m:good){
ans.insert(make_tuple(m.second,penalty[m.first],m.first));
}
auto beg = ans.begin();
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg) <<endl;
beg++;
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg) <<endl;
beg++;
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg) <<endl;
int now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
int then1 = get<0>(*beg),then2 = get<1>(*beg);
while(now1 == then1 && now2 == then2){
cout << get<2>(*beg)<<" " <<get<0>(*beg)<< " "<<get<1>(*beg) <<endl;
now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
then1 = get<0>(*beg),then2 = get<1>(*beg);
}
} | # 2069529, 2024-11-02 10:55:32, xxxxxxxxPPxPPPPPPPPPP (57%)
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string,int> penalty,wrong,good;
int num;
map<string,bool> quest;
int min;
string team,check,q;
cin >> num;
for(int i = 0;i<num;i++){
cin >> min >> team >> q >> check;
if(quest[q + team])continue;
else {
if(check == "T"){
penalty[team] += min;
penalty[team] += wrong[q+team];
quest[q+team] = true;
good[team]++;
}
else wrong[q+team] +=20;
}
}
set<tuple<int,int,string>> ans;
for(auto m:good){
ans.insert(make_tuple(-m.second,penalty[m.first],m.first));
}
auto beg = ans.begin();
cout << (get<2>(*beg))<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
beg++;
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
beg++;
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
int now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
int then1 = get<0>(*beg),then2 = get<1>(*beg);
while(now1 == then1 && now2 == then2){
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
then1 = get<0>(*beg),then2 = get<1>(*beg);
}
} | # 2069561, 2024-11-02 10:58:44, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string,int> penalty,wrong,good;
int num;
map<string,bool> quest;
int min;
string team,check,q;
cin >> num;
for(int i = 0;i<num;i++){
cin >> min >> team >> q >> check;
if(quest[q + team])continue;
else {
if(check == "T"){
penalty[team] += min;
penalty[team] += wrong[q+team];
quest[q+team] = true;
good[team]++;
}
else wrong[q+team] +=20;
}
}
set<tuple<int,int,string>> ans;
for(auto m:good){
ans.insert(make_tuple(-m.second,penalty[m.first],m.first));
}
auto beg = ans.begin();
cout << (get<2>(*beg))<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
beg++;
if(get<0>(*beg) == 0)return 0;
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
beg++;
if(get<0>(*beg) == 0)return 0;
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
int now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
if(get<0>(*beg) == 0)return 0;
int then1 = get<0>(*beg),then2 = get<1>(*beg);
while(now1 == then1 && now2 == then2){
cout << get<2>(*beg)<<" " <<abs(get<0>(*beg))<< " "<<get<1>(*beg) <<endl;
now1 = get<0>(*beg),now2 = get<1>(*beg);
beg++;
if(get<0>(*beg) == 0)return 0;
then1 = get<0>(*beg),then2 = get<1>(*beg);
}
} |
# 2069552, 2024-11-02 10:57:58, PP------------------- (9%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
map<string,int>time;
map<string,set<int>>q;
map<string,int>corrected;
for(int i=0;i<n;i++){
int min,question;
string team,correct;
cin>>min>>team>>question>>correct;
if(q[team].find(question)==q[team].end()){
if(correct=="F"){
time[team]+=20;
}else{
time[team]+=min;
q[team].insert(question);
corrected[team]=-(q[team].size());
}
}
int out=0;
int ctime=0;
for(auto&p:corrected){
if(out!=3){
cout<<p.first<<" "<<-(p.second)<<" "<<time[p.first]<<endl;
out++;
ctime=time[p.first];
}else{
if(time[p.first]!=ctime)break;
else{
cout<<p.first<<" "<<-(p.second)<<" "<<time[p.first]<<endl;
}
}
}
}
} | # 2069743, 2024-11-02 11:21:03, PPPP-P---P----------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
map<string,int>time;
map<string,set<int>>q;
map<string,int>corrected;
map<string,vector<int>>attempt;
for(int i=0;i<n;i++){
int min,question;
string team,correct;
cin>>min>>team>>question>>correct;
if(q[team].find(question)==q[team].end()){
attempt[team].push_back(question);
if(correct=="F"){
time[team]+=20;
}else{
time[team]+=min;
q[team].insert(question);
corrected[team]-=1;
}
}
}
for(auto &p:attempt){
for(auto &i:p.second){
if(q[p.first].find(i)==q[p.first].end())time[p.first]-=20;
}
}
int out=0;
int ctime=0;
for(auto&p:corrected){
if(out!=3){
cout<<p.first<<" "<<-(p.second)<<" "<<time[p.first]<<endl;
out++;
ctime=time[p.first];
}else{
if(time[p.first]!=ctime)break;
else{
cout<<p.first<<" "<<-(p.second)<<" "<<time[p.first]<<endl;
}
}
}
} | # 2069910, 2024-11-02 11:36:10, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
bool srt(tuple<int,int,string> &a,tuple<int,int,string> &b){
if(get<0>(a)!=get<0>(b))return get<0>(a)>get<0>(b);
else if(get<0>(a)==get<0>(b)&&get<1>(a)!=get<1>(b))return get<1>(a)<get<1>(b);
else return get<2>(a)<get<2>(b);
}
int main(){
int n;
cin>>n;
map<string,int>time;
map<string,set<int>>q;
map<string,int>corrected;
map<string,vector<int>>attempt;
set<string>name;
for(int i=0;i<n;i++){
int min,question;
string team,correct;
cin>>min>>team>>question>>correct;
name.insert(team);
if(q[team].find(question)==q[team].end()){
attempt[team].push_back(question);
if(correct=="F"){
time[team]+=20;
}else{
time[team]+=min;
q[team].insert(question);
corrected[team]+=1;
}
}
}
for(auto &p:attempt){
for(auto &i:p.second){
if(q[p.first].find(i)==q[p.first].end())time[p.first]-=20;
}
}
vector<tuple<int,int,string>> ans;
for(auto &s:name){
ans.push_back(make_tuple(corrected[s],time[s],s));
}
sort(ans.begin(),ans.end(),srt);
int out=0;
int ctime=0;
for(auto&t:ans){
if(get<0>(t)==0)break;
else{
if(out!=3){
cout<<get<2>(t)<<" "<<get<0>(t)<<" "<<get<1>(t)<<endl;
out++;
ctime=get<1>(t);
}else{
if(ctime!=get<1>(t))break;
else{
cout<<get<2>(t)<<" "<<get<0>(t)<<" "<<get<1>(t)<<endl;
}
}
}
}
} |
# 2071392, 2024-11-02 14:30:47, --------------------- (0%)
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
class Problem
{
int attemps;
bool correct;
int correct_time;
public:
Problem() : attemps(0), correct(false), correct_time(0) {}
void add(int time, bool correct)
{
if (this->correct)
return;
if (correct)
{
this->correct = true;
this->correct_time = time;
}
else
attemps++;
}
int get_penalty() const
{
return correct * (correct_time + (attemps * 20));
}
bool is_correct() const
{
return correct;
}
};
class GraderForTeam
{
std::unordered_map<int, Problem> problems;
public:
void add(int time, int problem, int correct)
{
problems[problem].add(time, correct);
}
int get_score() const
{
int score = 0;
for (const auto &[_, problem] : problems)
{
score += problem.is_correct();
}
return score;
}
int get_penalty() const
{
int penalty = 0;
for (const auto &[_, problem] : problems)
{
penalty += problem.get_penalty();
}
return penalty;
}
bool operator<(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) ? get_penalty() < other.get_penalty() : get_score() > other.get_score();
}
bool operator==(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) && (get_penalty() == other.get_penalty());
}
};
int main()
{
int n;
std::unordered_map<std::string, GraderForTeam> teams;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
int time, problem;
std::string team;
char correct;
std::cin >> time >> team >> problem >> correct;
teams[team].add(time, problem, correct == 'T');
}
std::vector<std::pair<std::string, GraderForTeam>> ordered_team(teams.begin(), teams.end());
std::sort(ordered_team.begin(), ordered_team.end(), [](const std::pair<std::string, GraderForTeam> &a, const std::pair<std::string, GraderForTeam> &b) {
return (a.second == b.second) ? a.first < b.first : a.second < b.second;
});
int printed_team = 0;
GraderForTeam last_printed_team;
for (const auto &[team_name, team] : ordered_team)
{
if (printed_team >= 3 && !(team == last_printed_team))
break;
std::cout << team_name << ": " << team.get_score() << " " << team.get_penalty() << "\n";
last_printed_team = team;
printed_team++;
}
} | # 2071417, 2024-11-02 14:33:05, --------------------- (0%)
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
class Problem
{
int attemps;
bool correct;
int correct_time;
public:
Problem() : attemps(0), correct(false), correct_time(0) {}
void add(int time, bool correct)
{
if (this->correct)
return;
if (correct)
{
this->correct = true;
this->correct_time = time;
}
else
attemps++;
}
int get_penalty() const
{
return correct * (correct_time + (attemps * 20));
}
bool is_correct() const
{
return correct;
}
};
class GraderForTeam
{
std::unordered_map<int, Problem> problems;
public:
void add(int time, int problem, int correct)
{
problems[problem].add(time, correct);
}
int get_score() const
{
int score = 0;
for (const auto &[_, problem] : problems)
{
score += problem.is_correct();
}
return score;
}
int get_penalty() const
{
int penalty = 0;
for (const auto &[_, problem] : problems)
{
penalty += problem.get_penalty();
}
return penalty;
}
bool operator<(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) ? get_penalty() < other.get_penalty() : get_score() > other.get_score();
}
bool operator==(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) && (get_penalty() == other.get_penalty());
}
};
int main()
{
int n;
std::unordered_map<std::string, GraderForTeam> teams;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
int time, problem;
std::string team;
char correct;
std::cin >> time >> team >> problem >> correct;
teams[team].add(time, problem, correct == 'T');
}
std::vector<std::pair<std::string, GraderForTeam>> ordered_team(teams.begin(), teams.end());
std::sort(ordered_team.begin(), ordered_team.end(), [](const std::pair<std::string, GraderForTeam> &a, const std::pair<std::string, GraderForTeam> &b) {
return (a.second == b.second) ? a.first < b.first : a.second < b.second;
});
int printed_team = 0;
GraderForTeam last_printed_team;
for (const auto &[team_name, team] : ordered_team)
{
if (printed_team >= 3 && !(team == last_printed_team) || team.get_score() == 0)
break;
std::cout << team_name << ": " << team.get_score() << " " << team.get_penalty() << "\n";
last_printed_team = team;
printed_team++;
}
} | # 2071429, 2024-11-02 14:34:07, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
class Problem
{
int attemps;
bool correct;
int correct_time;
public:
Problem() : attemps(0), correct(false), correct_time(0) {}
void add(int time, bool correct)
{
if (this->correct)
return;
if (correct)
{
this->correct = true;
this->correct_time = time;
}
else
attemps++;
}
int get_penalty() const
{
return correct * (correct_time + (attemps * 20));
}
bool is_correct() const
{
return correct;
}
};
class GraderForTeam
{
std::unordered_map<int, Problem> problems;
public:
void add(int time, int problem, int correct)
{
problems[problem].add(time, correct);
}
int get_score() const
{
int score = 0;
for (const auto &[_, problem] : problems)
{
score += problem.is_correct();
}
return score;
}
int get_penalty() const
{
int penalty = 0;
for (const auto &[_, problem] : problems)
{
penalty += problem.get_penalty();
}
return penalty;
}
bool operator<(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) ? get_penalty() < other.get_penalty() : get_score() > other.get_score();
}
bool operator==(const GraderForTeam &other) const
{
return (get_score() == other.get_score()) && (get_penalty() == other.get_penalty());
}
};
int main()
{
int n;
std::unordered_map<std::string, GraderForTeam> teams;
std::cin >> n;
for (int i = 0; i < n; ++i)
{
int time, problem;
std::string team;
char correct;
std::cin >> time >> team >> problem >> correct;
teams[team].add(time, problem, correct == 'T');
}
std::vector<std::pair<std::string, GraderForTeam>> ordered_team(teams.begin(), teams.end());
std::sort(ordered_team.begin(), ordered_team.end(), [](const std::pair<std::string, GraderForTeam> &a, const std::pair<std::string, GraderForTeam> &b) {
return (a.second == b.second) ? a.first < b.first : a.second < b.second;
});
int printed_team = 0;
GraderForTeam last_printed_team;
for (const auto &[team_name, team] : ordered_team)
{
if (printed_team >= 3 && !(team == last_printed_team) || team.get_score() == 0)
break;
std::cout << team_name << " " << team.get_score() << " " << team.get_penalty() << "\n";
last_printed_team = team;
printed_team++;
}
} |
# 2069793, 2024-11-02 11:25:24, PPPP-P---P----------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<string, pair<set<int>, int>> team;
map<string, map<int, bool>> corr;
map<string, map<int, int>> pen;
int n;
cin>>n;
vector< tuple<pair<int, string>, int, string> > submis;
while(n--){
int m, id;
string pp, ch;
cin>>m>>pp>>id>>ch;
if(ch == "T"){
team[pp].first.insert(id);
}
team[pp].second = 0;
pen[pp][id] = 0;
corr[pp][id] = false;
tuple<pair<int, string>, int, string> asd = {make_pair(m, pp), id, ch};
submis.push_back(asd);
}
for(auto &sd:submis){
int m, id;
string pp, ch;
m = get<0>(sd).first;
id = get<1>(sd);
pp = get<0>(sd).second;
ch = get<2>(sd);
if(ch == "T"){
if(!corr[pp][id]){
team[pp].second += m + pen[pp][id];
}
corr[pp][id] = true;
}
else if(ch == "F"){
pen[pp][id] += 20;
}
}
if(team.size() < 3){
for(auto &s:team){
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
}
}
else{
int i =0;
for(auto &s:team){
if(i == 3) break;
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
i++;
}
}
/*
12
10 A 1 T
23 A 3 F
30 A 3 F
45 A 2 F
60 B 2 T
65 A 3 T
84 B 1 T
115 B 4 T
120 A 4 T
125 B 4 F
125 B 4 T
125 A 4 F
*/
return 0;
} | # 2070026, 2024-11-02 11:45:34, -xx-----PP-PPPPPPPPPP (57%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<string, pair<set<int>, int>> team;
map<string, map<int, bool>> corr;
map<string, map<int, int>> pen;
int n;
cin>>n;
vector< tuple<pair<int, string>, int, string> > submis;
while(n--){
int m, id;
string pp, ch;
cin>>m>>pp>>id>>ch;
if(ch == "T"){
team[pp].first.insert(id);
}
team[pp].second = 0;
pen[pp][id] = 0;
corr[pp][id] = false;
tuple<pair<int, string>, int, string> asd = {make_pair(m, pp), id, ch};
submis.push_back(asd);
}
for(auto &sd:submis){
int m, id;
string pp, ch;
m = get<0>(sd).first;
id = get<1>(sd);
pp = get<0>(sd).second;
ch = get<2>(sd);
if(ch == "T"){
if(!corr[pp][id]){
team[pp].second += m + pen[pp][id];
}
corr[pp][id] = true;
}
else if(ch == "F"){
pen[pp][id] += 20;
}
}
/*if(team.size() < 3){
for(auto &s:team){
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
}
}
else{
int i =0;
for(auto &s:team){
if(i == 3) break;
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
i++;
}
}*/
vector<tuple<string, int, int>> ans;
//cout<<endl<<endl;
for(auto &s:team){
//cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
ans.push_back(make_tuple(s.first, s.second.first.size(), s.second.second));
}
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<0>(a) < get<0>(b);
});
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<2>(a) < get<2>(b);
});
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<1>(a) > get<1>(b);
});
for(int i=0;i<3;i++){
cout<<get<0>(ans[i])<<' '<<get<1>(ans[i])<<' '<<get<2>(ans[i])<<endl;
}
for(int i=3;i<ans.size();i++){
if(get<1>(ans[i]) == get<1>(ans[2]) && get<2>(ans[i]) == get<2>(ans[2])){
cout<<get<0>(ans[i])<<' '<<get<1>(ans[i])<<' '<<get<2>(ans[i])<<endl;
}
}
/*
9
8 Nattee 1 F
10 Nattee 1 T
12 Somchai 7 T
13 Jessada 2 F
15 Chate 1 T
20 Kamonluk 2 T
35 Chate 7 F
45 Chate 7 T
50 Somchai 2 T
*/
/*
12
10 A 1 T
23 A 3 F
30 A 3 F
45 A 2 F
60 B 2 T
65 A 3 T
84 B 1 T
115 B 4 T
120 A 4 T
125 B 4 F
125 B 4 T
125 A 4 F
*/
return 0;
} | # 2070083, 2024-11-02 11:49:43, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
map<string, pair<set<int>, int>> team;
map<string, map<int, bool>> corr;
map<string, map<int, int>> pen;
int n;
cin>>n;
vector< tuple<pair<int, string>, int, string> > submis;
while(n--){
int m, id;
string pp, ch;
cin>>m>>pp>>id>>ch;
if(ch == "T"){
team[pp].first.insert(id);
}
team[pp].second = 0;
pen[pp][id] = 0;
corr[pp][id] = false;
tuple<pair<int, string>, int, string> asd = {make_pair(m, pp), id, ch};
submis.push_back(asd);
}
for(auto &sd:submis){
int m, id;
string pp, ch;
m = get<0>(sd).first;
id = get<1>(sd);
pp = get<0>(sd).second;
ch = get<2>(sd);
if(ch == "T"){
if(!corr[pp][id]){
team[pp].second += m + pen[pp][id];
}
corr[pp][id] = true;
}
else if(ch == "F"){
pen[pp][id] += 20;
}
}
/*if(team.size() < 3){
for(auto &s:team){
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
}
}
else{
int i =0;
for(auto &s:team){
if(i == 3) break;
cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
i++;
}
}*/
vector<tuple<string, int, int>> ans;
//cout<<endl<<endl;
for(auto &s:team){
//cout<< s.first<<' '<<s.second.first.size()<<' '<<s.second.second <<endl;
ans.push_back(make_tuple(s.first, s.second.first.size(), s.second.second));
}
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<0>(a) < get<0>(b);
});
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<2>(a) < get<2>(b);
});
sort(ans.begin(), ans.end(), [](const tuple<string, int, int> &a, const tuple<string, int, int> &b){
return get<1>(a) > get<1>(b);
});
if(ans.size() <= 3){
for(auto &s:ans){
if(get<1>(s) != 0) cout<<get<0>(s)<<' '<<get<1>(s)<<' '<<get<2>(s)<<endl;
}
}
else{
for(int i=0;i<3;i++){
if(get<1>(ans[i]) != 0) cout<<get<0>(ans[i])<<' '<<get<1>(ans[i])<<' '<<get<2>(ans[i])<<endl;
}
for(int i=3;i<ans.size();i++){
if(get<1>(ans[i]) == get<1>(ans[2]) && get<2>(ans[i]) == get<2>(ans[2])){
if(get<1>(ans[i]) != 0) cout<<get<0>(ans[i])<<' '<<get<1>(ans[i])<<' '<<get<2>(ans[i])<<endl;
}
}
}
/*
9
8 Nattee 1 F
10 Nattee 1 T
12 Somchai 7 T
13 Jessada 2 F
15 Chate 1 T
20 Kamonluk 2 T
35 Chate 7 F
45 Chate 7 T
50 Somchai 2 T
*/
/*
12
10 A 1 T
23 A 3 F
30 A 3 F
45 A 2 F
60 B 2 T
65 A 3 T
84 B 1 T
115 B 4 T
120 A 4 T
125 B 4 F
125 B 4 T
125 A 4 F
*/
return 0;
} |
# 2069770, 2024-11-02 11:23:06, P---PPPPPP--PPPPP---- (57%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;
int main(){
int n;
cin >> n;
map<string , map<int , bool>> info;
map<string , int> penalty;
map<string , map<int , bool>> FirstWrong;
map<string , int> count;
for(int i = 0 ; i < n ; i++){
int time , question;
string name;
char done;
cin >> time >> name >> question >> done;
if(done == 'T' && !info[name][question]){
info[name][question] = true;
if(penalty.find(name) == penalty.end()){
penalty[name] = time;
}
else{
penalty[name] = penalty[name] + time;
}
if(count.find(name) == count.end()){
count[name] = 1;
}
else if(count.find(name) != count.end()){
count[name]++;
}
}
else if(done == 'F'){
if(info[name].find(question) != info[name].end() && info[name][question]) // Correct Before
continue;
else if(info[name].find(question) != info[name].end() && !info[name][question]){ // Wrong Again
if(penalty.find(name) == penalty.end() && FirstWrong[name][question]){
penalty[name] = 40;
FirstWrong[name][question] = false;
}
else if(penalty.find(name) != penalty.end() && FirstWrong[name][question]){
penalty[name] = penalty[name] + 40;
FirstWrong[name][question] =true;
}
else if(penalty.find(name) != penalty.end() && !FirstWrong[name][question]){
penalty[name] = penalty[name] + 20;
}
}
else if(info[name].find(question) == info[name].end()){ // First Wrong
info[name][question] = false;
FirstWrong[name][question] = true;
}
}
}
vector<tuple<string , int , int>> scoreboard;
for(auto x : info){
scoreboard.push_back(make_tuple(x.first , count[x.first] , penalty[x.first]));
}
sort(scoreboard.begin() , scoreboard.end() , [&](tuple<string , int , int> a , tuple<string , int , int> b){
if(get<1>(a) != get<1>(b))
return get<1>(a) > get<1>(b);
else
return get<2>(a) < get<2>(b);
});
int rank = 1;
int cnt = 0 , pnt = 0;
for(auto x : scoreboard){
if(rank < 4){
cnt = get<1>(x);
pnt = get<2>(x);
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else if(rank >= 4 && get<1>(x) == cnt && get<2>(x) == pnt){
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else
break;
rank++;
}
return 0;
} | # 2069819, 2024-11-02 11:28:03, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;
int main(){
int n;
cin >> n;
map<string , map<int , bool>> info;
map<string , int> penalty;
map<string , map<int , int>> stack;
map<string , int> count;
for(int i = 0 ; i < n ; i++){
int time , question;
string name;
char done;
cin >> time >> name >> question >> done;
if(done == 'T' && !info[name][question]){
info[name][question] = true;
if(penalty.find(name) == penalty.end()){
penalty[name] = time + 20 * (stack[name][question]);
}
else{
penalty[name] = penalty[name] + time + 20 * (stack[name][question]);
}
if(count.find(name) == count.end()){
count[name] = 1;
}
else if(count.find(name) != count.end()){
count[name]++;
}
}
else if(done == 'F'){
if(info[name].find(question) != info[name].end() && info[name][question]) // Correct Before
continue;
else if(info[name].find(question) != info[name].end() && !info[name][question]){ // Wrong Again
stack[name][question]++;
}
else if(info[name].find(question) == info[name].end()){ // First Wrong
info[name][question] = false;
stack[name][question] = 1;
}
}
}
vector<tuple<string , int , int>> scoreboard;
for(auto x : info){
scoreboard.push_back(make_tuple(x.first , count[x.first] , penalty[x.first]));
}
sort(scoreboard.begin() , scoreboard.end() , [&](tuple<string , int , int> a , tuple<string , int , int> b){
if(get<1>(a) != get<1>(b))
return get<1>(a) > get<1>(b);
else
return get<2>(a) < get<2>(b);
});
int rank = 1;
int cnt = 0 , pnt = 0;
for(auto x : scoreboard){
if(rank < 4){
cnt = get<1>(x);
pnt = get<2>(x);
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else if(rank >= 4 && get<1>(x) == cnt && get<2>(x) == pnt){
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else
break;
rank++;
}
return 0;
} | # 2069833, 2024-11-02 11:28:53, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;
int main(){
int n;
cin >> n;
map<string , map<int , bool>> info;
map<string , int> penalty;
map<string , map<int , int>> stack;
map<string , int> count;
for(int i = 0 ; i < n ; i++){
int time , question;
string name;
char done;
cin >> time >> name >> question >> done;
if(done == 'T' && !info[name][question]){
info[name][question] = true;
if(penalty.find(name) == penalty.end()){
penalty[name] = time + 20 * (stack[name][question]);
}
else{
penalty[name] = penalty[name] + time + 20 * (stack[name][question]);
}
if(count.find(name) == count.end()){
count[name] = 1;
}
else if(count.find(name) != count.end()){
count[name]++;
}
}
else if(done == 'F'){
if(info[name].find(question) != info[name].end() && info[name][question]) // Correct Before
continue;
else if(info[name].find(question) != info[name].end() && !info[name][question]){ // Wrong Again
stack[name][question]++;
}
else if(info[name].find(question) == info[name].end()){ // First Wrong
info[name][question] = false;
stack[name][question] = 1;
}
}
}
vector<tuple<string , int , int>> scoreboard;
for(auto x : info){
scoreboard.push_back(make_tuple(x.first , count[x.first] , penalty[x.first]));
}
sort(scoreboard.begin() , scoreboard.end() , [&](tuple<string , int , int> a , tuple<string , int , int> b){
if(get<1>(a) != get<1>(b))
return get<1>(a) > get<1>(b);
else
return get<2>(a) < get<2>(b);
});
int rank = 1;
int cnt = 0 , pnt = 0;
for(auto x : scoreboard){
if(get<1>(x) == 0)
break;
if(rank < 4){
cnt = get<1>(x);
pnt = get<2>(x);
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else if(rank >= 4 && get<1>(x) == cnt && get<2>(x) == pnt){
cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << endl;
}
else
break;
rank++;
}
return 0;
} |
# 2071311, 2024-11-02 14:21:49, PPPPPPPPPP-P-P-PP---- (66%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(tuple<ll,ll,string> & a,tuple<ll,ll,string> &b){
if(get<0>(a) == get<0>(b)){
if(get<1>(a) == get<1>(b))return get<2>(a) < get<2>(b);
return get<1>(a) < get<1>(b);
}
return get<0>(a) > get<0>(b);
}
int main(){
ll n;
cin >> n;
map<string,map<string,pair<ll,bool>>> ttq;
vector<tuple<ll,ll,string>> list;
while (n--){
ll minute;
string name,result,quiz;
cin >> minute >> name >> quiz >> result;
if(ttq[name][name+quiz].second == false){
if(result == "T"){
ttq[name][name+quiz].first *=20;
ttq[name][name+quiz].first +=minute;
ttq[name][name+quiz].second = true;
}
else{
ttq[name][name+quiz].first++;
}
}
}
for(auto &e:ttq){
ll corect = 0,pe = 0;
for (auto &i:e.second){
if(i.second.second){
corect++;
pe +=i.second.first;
}
}
list.push_back(make_tuple(corect,pe,e.first));
}
sort(list.begin(),list.end(),cmp);
for (auto &i: list){
cout << get<2>(i) << " " << get<0>(i) << " " << get<1>(i) << endl;
}
} | # 2071334, 2024-11-02 14:23:58, PPPPPPPPPP-PP-P----P- (66%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(tuple<ll,ll,string> & a,tuple<ll,ll,string> &b){
if(get<0>(a) == get<0>(b)){
if(get<1>(a) == get<1>(b))return get<2>(a) < get<2>(b);
return get<1>(a) < get<1>(b);
}
return get<0>(a) > get<0>(b);
}
int main(){
ll n;
cin >> n;
map<string,map<string,pair<ll,bool>>> ttq;
vector<tuple<ll,ll,string>> list;
while (n--){
ll minute;
string name,result,quiz;
cin >> minute >> name >> quiz >> result;
if(ttq[name][name+quiz].second == false){
if(result == "T"){
ttq[name][name+quiz].first *=20;
ttq[name][name+quiz].first +=minute;
ttq[name][name+quiz].second = true;
}
else{
ttq[name][name+quiz].first++;
}
}
}
for(auto &e:ttq){
ll corect = 0,pe = 0;
for (auto &i:e.second){
if(i.second.second){
corect++;
pe +=i.second.first;
}
}
list.push_back(make_tuple(corect,pe,e.first));
}
sort(list.begin(),list.end(),cmp);
int m = 3;
for (auto &i: list){
cout << get<2>(i) << " " << get<0>(i) << " " << get<1>(i) << endl;
m--;
if(m == 0)break;
}
} | # 2071408, 2024-11-02 14:32:22, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool cmp(tuple<ll,ll,string> & a,tuple<ll,ll,string> &b){
if(get<0>(a) == get<0>(b)){
if(get<1>(a) == get<1>(b))return get<2>(a) < get<2>(b);
return get<1>(a) < get<1>(b);
}
return get<0>(a) > get<0>(b);
}
int main(){
ll n;
cin >> n;
map<string,map<string,pair<ll,bool>>> ttq;
vector<tuple<ll,ll,string>> list;
while (n--){
ll minute;
string name,result,quiz;
cin >> minute >> name >> quiz >> result;
if(ttq[name][name+quiz].second == false){
if(result == "T"){
ttq[name][name+quiz].first *=20;
ttq[name][name+quiz].first +=minute;
ttq[name][name+quiz].second = true;
}
else{
ttq[name][name+quiz].first++;
}
}
}
for(auto &e:ttq){
ll corect = 0,pe = 0;
for (auto &i:e.second){
if(i.second.second){
corect++;
pe +=i.second.first;
}
}
list.push_back(make_tuple(corect,pe,e.first));
}
sort(list.begin(),list.end(),cmp);
ll m = 4,pena = -1;
ll show = 0;
for (auto &i: list){
if(pena != get<1>(i)){
pena = get<1>(i);
m--;
if(show >= 3)break;
if(m == 0)break;
}
if(get<0>(i)){
cout << get<2>(i) << " " << get<0>(i) << " " << get<1>(i) << endl;
show++;
}
}
} |
# 2071512, 2024-11-02 14:43:34, PPPP-P---P----------- (28%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n,t,no;
string team,tf;
cin>>n;
map<string,int> score,penalty;
map<string,map<int,int>> penofF;
map<string,vector<int>> corrects;
while(n--){
cin>>t>>team>>no>>tf;
if(tf=="T"&&find(corrects[team].begin(),corrects[team].end(),no)==corrects[team].end()){
score[team]++;
corrects[team].push_back(no);
penalty[team]+=t;
penalty[team]+=20*penofF[team][no];
}
if(tf=="F"){
penofF[team][no]++;
}
}
for(auto e:penalty){
cout<<e.first<<" "<<score[e.first]<<" "<<e.second<<endl;
}
// cout<<"wrongs\n";
// for(auto e:penofF){
// cout<<e.first<<" | ";
// for (auto a:e.second){
// cout<<"NO."<<a.first<<" | "<<a.second<<" ";
// }
// cout<<endl;
// }
} | # 2071658, 2024-11-02 15:00:09, PPPPP-PPPPP-P-P----P- (61%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n,t,no;
string team,tf;
cin>>n;
map<string,int> score,penalty;
map<string,map<int,int>> penofF;
map<string,vector<int>> corrects;
vector<tuple<int,int,string>> result;
while(n--){
cin>>t>>team>>no>>tf;
if(tf=="T"&&find(corrects[team].begin(),corrects[team].end(),no)==corrects[team].end()){
score[team]++;
corrects[team].push_back(no);
penalty[team]+=t;
penalty[team]+=20*penofF[team][no];
}
if(tf=="F"){
penofF[team][no]++;
}
}
for(auto e:penalty){
result.push_back(make_tuple(score[e.first],-e.second,e.first));
}
sort(result.begin(),result.end(),greater());
for(int i=0;i<result.size();i++){
auto e=result[i];
if(i>=3){
auto prev = result[i-1];
if (get<0>(prev)==get<0>(e)&&get<1>(prev)==get<1>(e));
else break;
}
cout<<get<2>(e)<<" "<<get<0>(e)<<" "<<-get<1>(e)<<endl;
}
// cout<<"wrongs\n";
// for(auto e:penofF){
// cout<<e.first<<" | ";
// for (auto a:e.second){
// cout<<"NO."<<a.first<<" | "<<a.second<<" ";
// }
// cout<<endl;
// }
} | # 2071782, 2024-11-02 15:15:11, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int n,t,no;
string team,tf;
cin>>n;
map<string,int> score,penalty;
map<string,map<int,int>> penofF;
map<string,vector<int>> corrects;
vector<tuple<int,int,string>> result;
while(n--){
cin>>t>>team>>no>>tf;
if(tf=="T"&&find(corrects[team].begin(),corrects[team].end(),no)==corrects[team].end()){
score[team]++;
corrects[team].push_back(no);
penalty[team]+=t;
penalty[team]+=20*penofF[team][no];
}
if(tf=="F"){
penofF[team][no]++;
}
}
for(auto e:penalty){
result.push_back(make_tuple(score[e.first],e.second,e.first));
}
sort(result.begin(),result.end(),[](tuple<int,int,string>a,tuple<int,int,string>b){
if(get<0>(a)==get<0>(b)){
if(get<1>(a)==get<1>(b)){
return get<2>(a)<get<2>(b);
}
return get<1>(a)<get<1>(b);
}
return get<0>(a)>get<0>(b);
});
for(int i=0;i<result.size();i++){
auto e=result[i];
if(i>=3){
auto prev = result[i-1];
if (get<0>(prev)==get<0>(e)&&get<1>(prev)==get<1>(e));
else break;
}
cout<<get<2>(e)<<" "<<get<0>(e)<<" "<<get<1>(e)<<endl;
}
// cout<<"wrongs\n";
// for(auto e:penofF){
// cout<<e.first<<" | ";
// for (auto a:e.second){
// cout<<"NO."<<a.first<<" | "<<a.second<<" ";
// }
// cout<<endl;
// }
} |
# 2071518, 2024-11-02 14:44:26, -xx-P-PPPP--P-P----P- (38%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
map<string,int> Score,Time,Pen;
map<string,bool> chk;//string = team + kor
set<string> team;
while(n--)
{
int ti;
char TF;
string te,kor;
bool tf;
cin >> ti >> te >> kor >>TF;
team.insert(te);
if(TF=='T') tf =1;
else if(TF == 'F') tf =0;
string status = te + kor;
// cout << chk[status] <<"\n";
if(!chk[status])
{
if(tf){Time[te] += ti+Pen[status]; chk[status] =1; Score[te] ++;}
else if(!tf) {Pen[status] += 20;}
}
}
vector<pair<pair<int,int>,string>> v;
for(auto st: team) v.push_back({{Score[st],Time[st]},st});
sort(v.begin(),v.end(),greater<pair<pair<int,int>,string>> ());
cout << "\n";
for(int i=0;i<v.size();i++)
{
for(int j=i+1;j<v.size();j++)
{
if(v[i].first.first == v[j].first.first && v[j].first.second<v[i].first.second) swap(v[i],v[j]);
}
}
for(int i=0;i<2;i++)
{
cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
for(int i=2;i<v.size();i++)
{
if(v[i].first.first == v[2].first.first && v[i].first.second == v[2].first.second)cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
} | # 2071556, 2024-11-02 14:48:33, PPPPP-PPPPP-P-P----P- (61%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
map<string,int> Score,Time,Pen;
map<string,bool> chk;//string = team + kor
set<string> team;
while(n--)
{
int ti;
char TF;
string te,kor;
bool tf;
cin >> ti >> te >> kor >>TF;
team.insert(te);
if(TF=='T') tf =1;
else if(TF == 'F') tf =0;
string status = te + kor;
// cout << chk[status] <<"\n";
if(!chk[status])
{
if(tf){Time[te] += ti+Pen[status]; chk[status] =1; Score[te] ++;}
else if(!tf) {Pen[status] += 20;}
}
}
vector<pair<pair<int,int>,string>> v;
for(auto st: team) {if(Score[st]!=0){v.push_back({{Score[st],Time[st]},st});}}
sort(v.begin(),v.end(),greater<pair<pair<int,int>,string>> ());
cout << "\n";
for(int i=0;i<v.size();i++)
{
for(int j=i+1;j<v.size();j++)
{
if(v[i].first.first == v[j].first.first && v[j].first.second<v[i].first.second) swap(v[i],v[j]);
}
}
if(v.size()>=2)
{
for(int i=0;i<2;i++)
{
cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
for(int i=2;i<v.size();i++)
{
if(v[i].first.first == v[2].first.first && v[i].first.second == v[2].first.second)cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
}
else cout << v[0].second << " " << v[0].first.first << " "<< v[0].first.second <<"\n";
} | # 2071582, 2024-11-02 14:51:10, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
map<string,int> Score,Time,Pen;
map<string,bool> chk;//string = team + kor
set<string> team;
while(n--)
{
int ti;
char TF;
string te,kor;
bool tf;
cin >> ti >> te >> kor >>TF;
team.insert(te);
if(TF=='T') tf =1;
else if(TF == 'F') tf =0;
string status = te + kor;
// cout << chk[status] <<"\n";
if(!chk[status])
{
if(tf){Time[te] += ti+Pen[status]; chk[status] =1; Score[te] ++;}
else if(!tf) {Pen[status] += 20;}
}
}
vector<pair<pair<int,int>,string>> v;
for(auto st: team) {if(Score[st]!=0){v.push_back({{Score[st],Time[st]},st});}}
sort(v.begin(),v.end(),greater<pair<pair<int,int>,string>> ());
cout << "\n";
for(int i=0;i<v.size();i++)
{
for(int j=i+1;j<v.size();j++)
{
if(v[i].first.first == v[j].first.first && v[j].first.second == v[i].first.second)
{
if(v[i].second > v[j].second) swap(v[i],v[j]);
}
if(v[i].first.first == v[j].first.first && v[j].first.second<v[i].first.second) swap(v[i],v[j]);
}
}
if(v.size()>=2)
{
for(int i=0;i<2;i++)
{
cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
for(int i=2;i<v.size();i++)
{
if(v[i].first.first == v[2].first.first && v[i].first.second == v[2].first.second)cout << v[i].second << " " << v[i].first.first << " "<< v[i].first.second <<"\n";
}
}
else cout << v[0].second << " " << v[0].first.first << " "<< v[0].first.second <<"\n";
} |
# 2069696, 2024-11-02 11:14:29, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j=0,n,previouspen,time,count=0,number;
string name,check;
map<string,unordered_set<int>> totalpass; //key is the team name. value is the set of the problems they've solved.
map<string,int> totalpen; //key is the team name. value is the total penalty they have.
map<string,map<int,int>> totalfail; //key is the team name. value is a map, the key is the problem they've failed, the key is the amount of times they've failed.
cin >> n;
for(i=0;i<n;i++){
cin >> time >> name >> number >> check;
if(totalpass.find(name)==totalpass.end()){
totalpass[name]={};
}
if(totalpen.find(name)==totalpen.end()){
totalpen[name]=0;
}
if(totalfail.find(name)==totalfail.end()){
totalfail[name]={};
}
if(check=="T"){ //they passed.
if(totalpass[name].find(number)==totalpass[name].end()){// this is the first time they passed.
totalpass[name].insert(number);
totalpen[name]+=time+((totalfail[name])[number])*20;
}
//do nothing if they passed the second time
}
if(check=="F"){ //they failed.
if(totalpass[name].find(number)==totalpass[name].end()){ //failed, never passed before.
(totalfail[name])[number]++;
}
else{ // failed, but they've passed before.
//do nothing. Also, how did they failed?
}
}
}
//this is where the things get seriously annoying.
vector<tuple<string,int,int>> v; //a vector of 3-ordered item, the first value is team name, the second value is the amount of the problems they've passed, the third value is their penalty.
map<string,unordered_set<int>>::iterator it;
set<int> s; // a set of amount of the problem each team've solved;
for(it=totalpass.begin();it!=totalpass.end();it++){
if(((*it).second).size()!=0){
v.push_back({(*it).first,((*it).second).size(),totalpen[(*it).first]});
s.insert(((*it).second).size());
}
}
sort(v.begin(),v.end(),[](const tuple<string,int,int> &a, const tuple<string,int,int> &b){
if(get<1>(a)!=get<1>(b)){
return get<1>(a) > get<1>(b);
}
if(get<2>(a)!=get<2>(b)){
return get<2>(a) < get<2>(b);
}
return get<0>(a) < get<0>(b);
});
set<int>::iterator it2=(--s.end());
previouspen=get<2>(v[0]);
while(count<3&&count<v.size()){
for(i=j;i<v.size();i++){
if(get<1>(v[i])==*it2&&previouspen==get<2>(v[i])){
cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << endl;
previouspen=get<2>(v[i]);
count++;
j++;
}
else{
if(get<1>(v[i])<*it2){
previouspen=get<2>(v[i]);
it2--;
break;
}
if(get<1>(v[i])==*it2){
previouspen=get<2>(v[i]);
break;
}
}
}
}
} | # 2070041, 2024-11-02 11:46:36, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j=0,n,previouspen,time,count=0,number;
string name,check;
map<string,unordered_set<int>> totalpass; //key is the team name. value is the set of the problems they've solved.
map<string,int> totalpen; //key is the team name. value is the total penalty they have.
map<string,unordered_map<int,int>> totalfail; //key is the team name. value is a map, the key is the problem they've failed, the key is the amount of times they've failed.
cin >> n;
for(i=0;i<n;i++){
cin >> time >> name >> number >> check;
if(totalpass.find(name)==totalpass.end()){
totalpass[name]={};
}
if(totalpen.find(name)==totalpen.end()){
totalpen[name]=0;
}
if(totalfail.find(name)==totalfail.end()){
totalfail[name]={};
}
if(check=="T"){ //they passed.
if(totalpass[name].find(number)==totalpass[name].end()){// this is the first time they passed.
totalpass[name].insert(number);
totalpen[name]+=time+((totalfail[name])[number])*20;
}
//do nothing if they passed the second time
}
if(check=="F"){ //they failed.
if(totalpass[name].find(number)==totalpass[name].end()){ //failed, never passed before.
(totalfail[name])[number]++;
}
else{ // failed, but they've passed before.
//do nothing. Also, how did they failed?
}
}
}
//this is where things get seriously annoying.
vector<tuple<string,int,int>> v; //a vector of 3-ordered item, the first value is team name, the second value is the amount of the problems they've passed, the third value is their penalty.
map<string,unordered_set<int>>::iterator it;
set<int> s; // a set of amount of the problem each team've solved;
for(it=totalpass.begin();it!=totalpass.end();it++){
if(((*it).second).size()!=0){
v.push_back({(*it).first,((*it).second).size(),totalpen[(*it).first]});
s.insert(((*it).second).size());
}
}
sort(v.begin(),v.end(),[](const tuple<string,int,int> &a, const tuple<string,int,int> &b){
if(get<1>(a)!=get<1>(b)){
return get<1>(a) > get<1>(b);
}
if(get<2>(a)!=get<2>(b)){
return get<2>(a) < get<2>(b);
}
return get<0>(a) < get<0>(b);
});
set<int>::iterator it2=(--s.end());
previouspen=get<2>(v[0]);
while(count<3&&count<v.size()){
for(i=j;i<v.size();i++){
if(get<1>(v[i])==*it2&&previouspen==get<2>(v[i])){
cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << endl;
previouspen=get<2>(v[i]);
count++;
j++;
}
else{
if(get<1>(v[i])<*it2){
previouspen=get<2>(v[i]);
it2--;
break;
}
if(get<1>(v[i])==*it2){
previouspen=get<2>(v[i]);
break;
}
}
}
}
} | # 2070051, 2024-11-02 11:47:29, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j=0,n,previouspen,time,count=0,number;
string name,check;
unordered_map<string,unordered_set<int>> totalpass; //key is the team name. value is the set of the problems they've solved.
map<string,int> totalpen; //key is the team name. value is the total penalty they have.
unordered_map<string,unordered_map<int,int>> totalfail; //key is the team name. value is a map, the key is the problem they've failed, the key is the amount of times they've failed.
cin >> n;
for(i=0;i<n;i++){
cin >> time >> name >> number >> check;
if(totalpass.find(name)==totalpass.end()){
totalpass[name]={};
}
if(totalpen.find(name)==totalpen.end()){
totalpen[name]=0;
}
if(totalfail.find(name)==totalfail.end()){
totalfail[name]={};
}
if(check=="T"){ //they passed.
if(totalpass[name].find(number)==totalpass[name].end()){// this is the first time they passed.
totalpass[name].insert(number);
totalpen[name]+=time+((totalfail[name])[number])*20;
}
//do nothing if they passed the second time
}
if(check=="F"){ //they failed.
if(totalpass[name].find(number)==totalpass[name].end()){ //failed, never passed before.
(totalfail[name])[number]++;
}
else{ // failed, but they've passed before.
//do nothing. Also, how did they failed?
}
}
}
//this is where things get seriously annoying.
vector<tuple<string,int,int>> v; //a vector of 3-ordered item, the first value is team name, the second value is the amount of the problems they've passed, the third value is their penalty.
unordered_map<string,unordered_set<int>>::iterator it;
set<int> s; // a set of amount of the problem each team've solved;
for(it=totalpass.begin();it!=totalpass.end();it++){
if(((*it).second).size()!=0){
v.push_back({(*it).first,((*it).second).size(),totalpen[(*it).first]});
s.insert(((*it).second).size());
}
}
sort(v.begin(),v.end(),[](const tuple<string,int,int> &a, const tuple<string,int,int> &b){
if(get<1>(a)!=get<1>(b)){
return get<1>(a) > get<1>(b);
}
if(get<2>(a)!=get<2>(b)){
return get<2>(a) < get<2>(b);
}
return get<0>(a) < get<0>(b);
});
set<int>::iterator it2=(--s.end());
previouspen=get<2>(v[0]);
while(count<3&&count<v.size()){
for(i=j;i<v.size();i++){
if(get<1>(v[i])==*it2&&previouspen==get<2>(v[i])){
cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << endl;
previouspen=get<2>(v[i]);
count++;
j++;
}
else{
if(get<1>(v[i])<*it2){
previouspen=get<2>(v[i]);
it2--;
break;
}
if(get<1>(v[i])==*it2){
previouspen=get<2>(v[i]);
break;
}
}
}
}
} |
# 2069335, 2024-11-02 10:37:31, PP-PP-PPPP--P-P----P- (52%)
#include<iostream>
#include<map>
#include<string>
#include<set>
#include<utility>
using namespace std;
int main(){
int n = 0;
cin >> n;
map< string , set<int> > team_doneProblems;
map< string , int > team_penalties;
map< pair<int , int > , string> topTeams;
for(int i = 0 ; i < n ; i++){
int time = 0;
string teamName;
int problem = 0;
char problemStatus;
cin >> time >> teamName >> problem >> problemStatus;
if( problemStatus == 'T'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end() ){
team_doneProblems[teamName].insert(problem);
team_penalties[teamName] += time;
}
}else if ( problemStatus == 'F'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end()){
team_penalties[teamName] += 20;
}
}
}
//top team map
//pair< -completeq , penalties> , teamName>
//completeq is negative since we want the most to be the first
//penalties is positive
auto it = team_penalties.begin();
while ( it != team_penalties.end()){
string teamName = (*it).first;
int qNum = team_doneProblems[teamName].size();
int penalties = team_penalties[teamName];
topTeams[ make_pair( -qNum , penalties )] = teamName;
it++;
}
auto itT = topTeams.begin();
int count = 0 ;
while( itT != topTeams.end()){
cout << (*itT).second << " " << 0-(*itT).first.first << " " << (*itT).first.second << endl;
count++;
if( count >= 3){ break; }
itT++;
}
} | # 2069407, 2024-11-02 10:44:09, PPPPP-PPPPP-P-P----P- (61%)
#include<iostream>
#include<map>
#include<string>
#include<set>
#include<utility>
using namespace std;
int main(){
int n = 0;
cin >> n;
map< string , set<int> > team_doneProblems;
map< string , multiset<int> > team_failProblems;
map< string , int > team_penalties;
map< pair<int , int > , string> topTeams;
for(int i = 0 ; i < n ; i++){
int time = 0;
string teamName;
int problem = 0;
char problemStatus;
cin >> time >> teamName >> problem >> problemStatus;
if( problemStatus == 'T'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end() ){
team_doneProblems[teamName].insert(problem);
team_penalties[teamName] += time;
}
}else if ( problemStatus == 'F'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end()){
team_failProblems[teamName].insert(problem);
}
}
}
//calculate penalties for failed problems
auto itFail = team_failProblems.begin();
while(itFail != team_failProblems.end()){
string teamName = (*itFail).first;
for(int i : (*itFail).second){
if( team_doneProblems[teamName].find(i) != team_doneProblems[teamName].end()){
team_penalties[teamName] += 20;
}
}
itFail++;
}
//top team map
//pair< -completeq , penalties> , teamName>
//completeq is negative since we want the most to be the first
//penalties is positive
auto it = team_penalties.begin();
while ( it != team_penalties.end()){
string teamName = (*it).first;
int qNum = team_doneProblems[teamName].size();
int penalties = team_penalties[teamName];
topTeams[ make_pair( -qNum , penalties )] = teamName;
it++;
}
auto itT = topTeams.begin();
int count = 0 ;
while( itT != topTeams.end()){
cout << (*itT).second << " " << 0-(*itT).first.first << " " << (*itT).first.second << endl;
count++;
if( count >= 3){ break; }
itT++;
}
} | # 2069531, 2024-11-02 10:55:46, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<iostream>
#include<map>
#include<string>
#include<set>
#include<utility>
using namespace std;
int main(){
int n = 0;
cin >> n;
map< string , set<int> > team_doneProblems;
map< string , multiset<int> > team_failProblems;
map< string , int > team_penalties;
map< pair<int , int > , set<string>> topTeams;
for(int i = 0 ; i < n ; i++){
int time = 0;
string teamName;
int problem = 0;
char problemStatus;
cin >> time >> teamName >> problem >> problemStatus;
if( problemStatus == 'T'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end() ){
team_doneProblems[teamName].insert(problem);
team_penalties[teamName] += time;
}
}else if ( problemStatus == 'F'){
//check if problem is already done
if( team_doneProblems[teamName].find(problem) == team_doneProblems[teamName].end()){
team_failProblems[teamName].insert(problem);
}
}
}
//calculate penalties for failed problems
auto itFail = team_failProblems.begin();
while(itFail != team_failProblems.end()){
string teamName = (*itFail).first;
for(int i : (*itFail).second){
if( team_doneProblems[teamName].find(i) != team_doneProblems[teamName].end()){
team_penalties[teamName] += 20;
}
}
itFail++;
}
//top team map
//pair< -completeq , penalties> , teamName>
//completeq is negative since we want the most to be the first
//penalties is positive
auto it = team_penalties.begin();
while ( it != team_penalties.end()){
string teamName = (*it).first;
int qNum = team_doneProblems[teamName].size();
int penalties = team_penalties[teamName];
topTeams[ make_pair( -qNum , penalties )].insert(teamName);
it++;
}
auto itT = topTeams.begin();
int count = 0 ;
while( itT != topTeams.end()){
for(string o : (*itT).second){
cout << o << " " << 0-(*itT).first.first << " " << (*itT).first.second << endl;
count++;
}
/*
if( itT != topTeams.begin()){
auto itTb = itT;
itTb--;
if( (*itT).first.first != (*itTb).first.first || (*itT).first.second != (*itTb).first.second ){
count++;
}
}else{
count++;
}
*/
if( count >= 3){ break; }
itT++;
}
} |
# 2069966, 2024-11-02 11:41:06, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ;
cin >> n ;
int time, order ; string name ; char bl ;
map<string, pair<int, int>> stat ;
map<int, set<string>> cor ;
for (int i = 0 ; i < n ; i++) {
cin >> time >> name >> order >> bl ;
if (cor.find(order) != cor.end() && cor[order].find(name) != cor[order].end()) { continue ;}
if (bl == 'T') {
cor[order].insert(name) ;
if (stat.find(name) != stat.end()) {
stat[name].second -= 1 ;
stat[name].first += time ;
}
else stat[name] = {time,-1} ;
}
else if (bl == 'F') {
if (cor.find(order) != cor.end() && cor[order].find(name) != cor[order].end()) {}
else {
// do
if (stat.find(name) != stat.end()) {
// found
stat[name].first += 20 ;
}
else stat[name] = {20,0} ;
}
}
}
map<int, set<pair<int, string>>> ans ;
for (auto a : stat) {
ans[a.second.second].insert({a.second.first, a.first}) ;
}
int j = 0 ; int now = -1 ;
for (auto b : ans) {
if (b.first == 0) break ;
for (pair<int, string> c : b.second) {
if (j < 3 || (c.first == now)) {
cout << c.second << " " << b.first*(-1) << " " << c.first << "\n" ;
now = c.first ;
j++ ;
}
else { now = -1 ; break ;}
}
}
} | # 2070458, 2024-11-02 12:09:20, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ;
cin >> n ;
int time, order ; string name ; char bl ;
map<string, pair<int, int>> stat ;
map<int, set<string>> cor ;
map<string, map<int, int>> team_pen ; map<string, set<int>> team_cor ;
for (int i = 0 ; i < n ; i++) {
cin >> time >> name >> order >> bl ;
if (cor.find(order) != cor.end() && cor[order].find(name) != cor[order].end()) { continue ;}
if (bl == 'T') {
cor[order].insert(name) ;
if (stat.find(name) != stat.end()) {
stat[name].second -= 1 ;
stat[name].first += time ;
}
else stat[name] = {time,-1} ;
team_cor[name].insert(order) ;
}
else if (bl == 'F') {
if (cor.find(order) != cor.end() && cor[order].find(name) != cor[order].end()) {}
else {
// do
if (stat.find(name) != stat.end()) {
// found
stat[name].first += 20 ;
}
else stat[name] = {20,0} ;
if (team_pen[name].find(order) != team_pen[name].end()) team_pen[name][order] += 1 ;
else team_pen[name][order] = 1 ;
}
}
}
for (auto a : team_pen) {
for (auto a1 : a.second) {
if (team_cor[a.first].find(a1.first) == team_cor[a.first].end()) {
stat[a.first].first -= 20*a1.second ;
}
}
}
map<int, set<pair<int, string>>> ans ;
for (auto a : stat) {
ans[a.second.second].insert({a.second.first, a.first}) ;
}
int j = 0 ; int now = -1 ;
for (auto b : ans) {
if (b.first == 0) break ;
for (pair<int, string> c : b.second) {
if (j < 3 || (c.first == now)) {
cout << c.second << " " << b.first*(-1) << " " << c.first << "\n" ;
now = c.first ;
j++ ;
}
else { now = -1 ; break ;}
}
}
} |
# 2069914, 2024-11-02 11:36:24, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
char sr;
int mi, prom;
string te;
set<string> cteam;
vector<string> team;
vector<int> penal, doit, wrong;
vector<pair<string, int>> minite, promble;
vector<pair<string, int>> submit;
vector<pair<string, char>> sroce;
while(n--)
{
cin >> mi >> te >> prom >> sr;
if(cteam.find(te) == cteam.end())
{
team.push_back(te);
penal.push_back(0);
doit.push_back(0);
}
int it = find(team.begin(), team.end(), te) - team.begin();
if(sr == 'T')
{
if(find(promble.begin(), promble.end(), make_pair(te, prom)) == promble.end())
{
penal[it] += mi;
doit[it]++;
promble.push_back(make_pair(te, prom));
submit.push_back(make_pair(te, prom));
wrong.push_back(0);
}
}
else
{
if(find(promble.begin(), promble.end(), make_pair(te, prom)) == promble.end())
{
submit.push_back(make_pair(te, prom));
wrong.push_back(20);
//cout << prom << endl;
}
}
minite.push_back(make_pair(te, mi));
sroce.push_back(make_pair(te, sr));
//submit.push_back(make_pair(te, prom));
//promble.push_back(make_pair(te, prom));
cteam.insert(te);
}
int c = 0;
for(auto i : submit)
{
int it = find(team.begin(), team.end(), i.first) - team.begin();
if(find(promble.begin(), promble.end(), make_pair(i.first, i.second)) != promble.end())
{
penal[it] += wrong[c];
}
c++;
}
map<string, int> dofor, p;
vector<pair<int, string>> manydo, penalty;
vector<pair<int, string>> result;
for(int i = 0; i < team.size(); i++)
{
//manydo.push_back(make_pair(doit[i], team[i]));
dofor[team[i]] = doit[i];
p[team[i]] = penal[i];
penalty.push_back(make_pair((penal[i] - (doit[i]* 100000)), team[i]));
}
sort(penalty.begin(), penalty.end());
c = 0;
int m ,l;
bool t = true;
for(auto i : penalty)
{
if(c >= 3)
{
t = false;
if(dofor[i.second] == m && p[i.second] == n)
{
cout << i.second << " " <<dofor[i.second] << " "<< p[i.second] << endl;
}
else break;
}
if(dofor[i.second] >= 1 && t){
cout << i.second << " " <<dofor[i.second] << " "<< p[i.second] << endl;
c++;
}
m = dofor[i.second];
n = p[i.second];
}
return 0;
} | # 2070482, 2024-11-02 12:10:10, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
char sr;
int mi, prom;
string te;
set<string> cteam;
vector<string> team;
vector<int> penal, doit, wrong;
vector<pair<string, int>> promble;
vector<pair<string, int>> submit;
while(n--)
{
cin >> mi >> te >> prom >> sr;
if(cteam.find(te) == cteam.end())
{
team.push_back(te);
penal.push_back(0);
doit.push_back(0);
}
int it = find(team.begin(), team.end(), te) - team.begin();
if(sr == 'T')
{
if(find(promble.begin(), promble.end(), make_pair(te, prom)) == promble.end())
{
penal[it] += mi;
doit[it]++;
promble.push_back(make_pair(te, prom));
submit.push_back(make_pair(te, prom));
wrong.push_back(0);
}
}
else
{
if(find(promble.begin(), promble.end(), make_pair(te, prom)) == promble.end())
{
submit.push_back(make_pair(te, prom));
wrong.push_back(20);
//cout << prom << endl;
}
}
cteam.insert(te);
}
int c = 0;
for(auto i : submit)
{
int it = find(team.begin(), team.end(), i.first) - team.begin();
if(find(promble.begin(), promble.end(), make_pair(i.first, i.second)) != promble.end())
{
penal[it] += wrong[c];
}
c++;
}
map<string, int> dofor, p;
vector<pair<int, string>> penalty;
for(int i = 0; i < team.size(); i++)
{
//manydo.push_back(make_pair(doit[i], team[i]));
dofor[team[i]] = doit[i];
p[team[i]] = penal[i];
penalty.push_back(make_pair((penal[i] - (doit[i]* 100000)), team[i]));
}
sort(penalty.begin(), penalty.end());
c = 0;
int m ,l;
bool t = true;
for(auto i : penalty)
{
if(c >= 3)
{
t = false;
if(dofor[i.second] == m && p[i.second] == n)
{
cout << i.second << " " <<dofor[i.second] << " "<< p[i.second] << endl;
}
else break;
}
if(dofor[i.second] >= 1 && t){
cout << i.second << " " <<dofor[i.second] << " "<< p[i.second] << endl;
c++;
}
m = dofor[i.second];
n = p[i.second];
}
return 0;
} |
# 2071394, 2024-11-02 14:30:56, PPPPPPPP--PP-----PP-- (57%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <set>
#include <map>
using namespace std;
int main()
{
int n;
map<pair<int,int>,set<string>,greater<pair<int,int>>> place;
//point,penalty
map<string, int> point;
map<string, map<int, int>> penalty;
map<string, map<int, bool>> pass;
map<string, map<int, int>> beforepass;
cin >> n;
for (int i = 0; i < n; i++)
{
int time, question;
string team, result;
cin >> time >> team >> question >> result;
if (pass[team][question] == true)
continue;
if (result == "T")
{
penalty[team][question] = time + 20 * beforepass[team][question];
pass[team][question] = true;
}
if (result == "F")
{
beforepass[team][question]++;
}
}
for (auto &team : pass)
{
for (auto &question : team.second)
{
if(question.second==true)
point[team.first] +=1;
}
}
for(auto&team:point){
int p=0;
for(auto&question:penalty[team.first]){
p+=question.second;
}
place[make_pair(team.second,-p)].insert(team.first);
}
int count =0;
for(auto &elem:place){
if(count==2) break;
for(auto&team: elem.second){
cout<<team<<" "<<elem.first.first<<" "<<abs(elem.first.second)<<endl;
}
count++;
}
} | # 2071501, 2024-11-02 14:42:47, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <cmath>
#include <set>
#include <map>
using namespace std;
int main()
{
int n;
map<pair<int,int>,set<string>,greater<pair<int,int>>> place;
//point,penalty
map<string, int> point;
map<string, map<int, int>> penalty;
map<string, map<int, bool>> pass;
map<string, map<int, int>> beforepass;
cin >> n;
for (int i = 0; i < n; i++)
{
int time, question;
string team, result;
cin >> time >> team >> question >> result;
if (pass[team][question] == true)
continue;
if (result == "T")
{
penalty[team][question] = time + 20 * beforepass[team][question];
pass[team][question] = true;
}
if (result == "F")
{
beforepass[team][question]++;
}
}
for (auto &team : pass)
{
for (auto &question : team.second)
{
if(question.second==true)
point[team.first] +=1;
}
}
for(auto&team:point){
int p=0;
for(auto&question:penalty[team.first]){
p+=question.second;
}
place[make_pair(team.second,-p)].insert(team.first);
}
int count =0,countteam=0;
for(auto &elem:place){
if(count==3) break;
if(countteam>=3) break;
for(auto&team: elem.second){
cout<<team<<" "<<elem.first.first<<" "<<abs(elem.first.second)<<endl;
countteam++;
}
count++;
}
} |
# 2071256, 2024-11-02 14:13:47, --------------------- (0%)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<pair<int,int>> Q1,Q2,Q3,Q4 ;
int main(){
int a;
cin >> a;
for(int i=0; i<a; i++){
int x,y;
cin >> x >> y;
if(x==0 || y==0) continue;
else{
pair<int, int> p={x,y};
if(x>0 && y>0) Q1.push_back(p);
if(x>0 && y<0) Q4.push_back(p);
if(x<0 && y>0) Q2.push_back(p);
if(x<0 && y<0) Q3.push_back(p);
}
}
int Q1_xmin=1e7, Q1_ymin=1e7, Q1_xmax=0, Q1_ymax=0;
for(int i=0; i<Q1.size(); i++){
if(Q1[i].first > Q1_xmax) Q1_xmax = Q1[i].first;
if(Q1[i].first < Q1_xmin) Q1_xmin = Q1[i].first;
if(Q1[i].second > Q1_ymax) Q1_ymax = Q1[i].second;
if(Q1[i].second < Q1_ymin) Q1_ymin = Q1[i].second;
}
int Q2_xmin=1e7, Q2_ymin=1e7, Q2_xmax=-1e7, Q2_ymax=-1e7;
for(int i=0; i<Q2.size(); i++){
if(Q2[i].first > Q2_xmax) Q2_xmax = Q2[i].first;
if(Q2[i].first < Q2_xmin) Q2_xmin = Q2[i].first;
if(Q2[i].second > Q2_ymax) Q2_ymax = Q2[i].second;
if(Q2[i].second < Q2_ymin) Q2_ymin = Q2[i].second;
}
int Q3_xmin=0, Q3_ymin=0, Q3_xmax=-1e7, Q3_ymax=-1e7;
for(int i=0; i<Q3.size(); i++){
if(Q3[i].first > Q3_xmax) Q3_xmax = Q3[i].first;
if(Q3[i].first < Q3_xmin) Q3_xmin = Q3[i].first;
if(Q3[i].second > Q3_ymax) Q3_ymax = Q3[i].second;
if(Q3[i].second < Q3_ymin) Q3_ymin = Q3[i].second;
}
int Q4_xmin=1e7, Q4_ymin=1e7, Q4_xmax=-1e7, Q4_ymax=-1e7;
for(int i=0; i<Q4.size(); i++){
if(Q4[i].first > Q4_xmax) Q4_xmax = Q4[i].first;
if(Q4[i].first < Q4_xmin) Q4_xmin = Q4[i].first;
if(Q4[i].second > Q4_ymax) Q4_ymax = Q4[i].second;
if(Q4[i].second < Q4_ymin) Q4_ymin = Q4[i].second;
}
if(Q1.empty() && Q2.empty() && Q3.empty() && Q4.empty()){
cout << "No point in any quadrant";
return 0;
}
if(!Q1.empty()){
if(Q1.size()==1){
cout << "Q1: (" << Q1[0].first << ", " << Q1[0].second << ") " <<
"(" << Q1[0].first << ", " << Q1[0].second << ") " << 0 << '\n';
}else{
cout << "Q1: (" << Q1_xmin << ", " << Q1_ymin << ") (" <<
Q1_xmax << ", " << Q1_ymax << ") " << (Q1_xmax-Q1_xmin)*(Q1_ymax-Q1_ymin) << '\n';
}
}
if(!Q2.empty()){
if(Q2.size()==1){
cout << "Q2: (" << Q2[0].first << ", " << Q2[0].second << ") " <<
"(" << Q2[0].first << ", " << Q2[0].second << ") " << 0 << '\n';
}else{
cout << "Q2: (" << Q2_xmin << ", " << Q2_ymin << ") (" <<
Q2_xmax << ", " << Q2_ymax << ") " << (Q2_xmax-Q2_xmin)*(Q2_ymax-Q2_ymin) << '\n';
}
}
if(!Q3.empty()){
if(Q3.size()==1){
cout << "Q3: (" << Q3[0].first << ", " << Q3[0].second << ") " <<
"(" << Q3[0].first << ", " << Q3[0].second << ") " << 0 << '\n';
}else{
cout << "Q3: (" << Q3_xmin << ", " << Q3_ymin << ") (" <<
Q3_xmax << ", " << Q3_ymax << ") " << (Q3_xmax-Q3_xmin)*(Q3_ymax-Q3_ymin) << '\n';
}
}
if(!Q4.empty()){
if(Q4.size()==1){
cout << "Q4: (" << Q4[0].first << ", " << Q4[0].second << ") " <<
"(" << Q4[0].first << ", " << Q4[0].second << ") " << 0 << '\n';
}else{
cout << "Q4: (" << Q4_xmin << ", " << Q4_ymin << ") (" <<
Q4_xmax << ", " << Q4_ymax << ") " << (Q4_xmax-Q4_xmin)*(Q4_ymax-Q4_ymin) << '\n';
}
}
// //1 point
// cout << "Q1: (" << Q1[0].first << ", " << Q1[0].second << ")" << 1 << '\n';
// //2 point up
// cout << "Q1: (" << Q1_xmin << ", " << Q1_ymin << ") (" <<
// Q1_xmax << ", " << Q1_ymax << ") " << (Q1_xmax-Q1_xmin)*(Q1_ymax-Q1_ymin) << '\n';
// cout << "Q2: (" << Q2_xmin << ", " << Q2_ymin << ") (" <<
// Q2_xmax << ", " << Q2_ymax << ") " << (Q2_xmax-Q2_xmin)*(Q2_ymax-Q2_ymin) << '\n';
// cout << "Q3: (" << Q3_xmin << ", " << Q3_ymin << ") (" <<
// Q3_xmax << ", " << Q3_ymax << ") " << (Q3_xmax-Q3_xmin)*(Q3_ymax-Q3_ymin) << '\n';
// cout << "Q4: (" << Q4_xmin << ", " << Q4_ymin << ") (" <<
// Q4_xmax << ", " << Q4_ymax << ") " << (Q4_xmax-Q4_xmin)*(Q4_ymax-Q4_ymin) << '\n';
}
/*
19
2 2
4 6
5 5
1 0
-1 2
-3 4
-2 6
0 -3
-5 7
-4 5
-6 3
0 4
-2 -2
-5 -6
-7 0
6 -4
4 -6
3 -2
2 -5
*/ | # 2071907, 2024-11-02 15:26:32, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
map<string , pair< vector<pair<int,int>>, pair< set<int> , int>>> m;
vector<pair<pair<int,int>, string>> ans;
vector<int > v;
int main(){
int a;
cin >> a;
for(int i=0; i<a; i++){
int time, exam;
string name, chk;
cin >> time >> name >> exam >> chk;
if(chk=="T"){
//find exam in carry
int cnt = 0;
for(auto a : m[name].first){
if(exam == a.second && time != a.first) cnt++;
}
//find exam in exam
if(m[name].second.first.count(exam) == 0){ //can not find right exam in exam
if(cnt == 0){ // never wrong
m[name].second.first.insert(exam);
m[name].second.second += time;
}else{ //ever wrong
int penalty = cnt * 20;
penalty += time;
m[name].second.first.insert(exam);
m[name].second.second += penalty;
}
}
}else{
//push the exam to wrong exam carry
m[name].first.push_back({time, exam});
}
}
for(auto a : m){
int correct = a.second.second.first.size();
int penalty = a.second.second.second;
string namee = a.first;
pair<int,int> p = {-correct, penalty};
pair<pair<int,int>, string> pp = {p, namee};
ans.push_back(pp);
}
sort(ans.begin(), ans.end());
if(ans.size()<=3){
for(auto a : ans){
if(a.first.first!=0) cout << a.second << " " << -a.first.first << " " << a.first.second << '\n';
}
}else{
int orderchk = 3;
for(int i=0; i<3; i++){
if(ans[i].first.first!=0) cout << ans[i].second << " " << -ans[i].first.first << " " << ans[i].first.second << '\n';
}
while(ans[orderchk].first.first == ans[orderchk-1].first.first && ans[orderchk].first.second == ans[orderchk-1].first.second){
if(ans[orderchk].first.first!=0) cout << ans[orderchk].second << " " << -ans[orderchk].first.first << " " << ans[orderchk].first.second << '\n';
orderchk++;
}
}
// for(auto a : m){
// cout << a.first << " : Wrong record ";
// for(auto b : a.second.first){
// cout << '\n' << b.first << " " << b.second;
// }
// cout << '\n' << "Right exam record" << '\n';
// for(auto b : a.second.second.first){
// cout << b << " ";
// }
// cout << '\n' << "Penalty score" << '\n';
// cout << a.second.second.second;
// cout << '\n';
// }
}
/*
4
10 D 1 T
15 C 1 F
20 K 2 F
20 J 3 F
*/ |
# 2071467, 2024-11-02 14:38:15, PPPPPPPPPP-PPPPPPPPPP (95%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
using namespace std;
int main(){
int n, time, no;
string team;
char status;
map<string, pair<int, int>> sheet;
// team -> [Point, Penalty]
map<pair<int, int>, set<string>> rev_sheet;
map<string, map<int, pair<bool, int>>> cor;
// team -> no -> <0/1, #fail>
cin >> n;
while(n--){
cin >> time >> team >> no >> status;
if(sheet.find(team) == sheet.end()){
sheet[team] = {0, 0};
cor[team];
}
if(cor[team].find(no) == cor[team].end()){
cor[team][no] = {0, 0};
}
if(cor[team][no].first == 0){
if(status == 'T'){
sheet[team].first--;
sheet[team].second += time + (20*cor[team][no].second);
cor[team][no].first = true;
}else if(status == 'F'){
cor[team][no].second++;
}
}
}
for(auto &e : sheet){
if(rev_sheet.find(e.second) == rev_sheet.end()) rev_sheet[e.second];
rev_sheet[e.second].insert(e.first);
}
auto itr = rev_sheet.begin();
int i = 0;
while(i < 3 && itr != rev_sheet.end()){
for(auto e : (*itr).second){
cout << e << " " << -1*((*itr).first.first) << " " << (*itr).first.second << endl;
i++;
}
itr++;
}
} | # 2071486, 2024-11-02 14:41:26, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <vector>
#include <set>
using namespace std;
int main(){
int n, time, no;
string team;
char status;
map<string, pair<int, int>> sheet;
// team -> [Point, Penalty]
map<pair<int, int>, set<string>> rev_sheet;
map<string, map<int, pair<bool, int>>> cor;
// team -> no -> <0/1, #fail>
cin >> n;
while(n--){
cin >> time >> team >> no >> status;
if(sheet.find(team) == sheet.end()){
sheet[team] = {0, 0};
cor[team];
}
if(cor[team].find(no) == cor[team].end()){
cor[team][no] = {0, 0};
}
if(cor[team][no].first == 0){
if(status == 'T'){
sheet[team].first--;
sheet[team].second += time + (20*cor[team][no].second);
cor[team][no].first = true;
}else if(status == 'F'){
cor[team][no].second++;
}
}
}
for(auto &e : sheet){
if(rev_sheet.find(e.second) == rev_sheet.end()) rev_sheet[e.second];
rev_sheet[e.second].insert(e.first);
}
auto itr = rev_sheet.begin();
int i = 0;
while(i < 3 && itr != rev_sheet.end()){
if((*itr).first.first == 0) break;
for(auto e : (*itr).second){
cout << e << " " << -1*((*itr).first.first) << " " << (*itr).first.second << endl;
i++;
}
itr++;
}
} |
# 2069714, 2024-11-02 11:16:53, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
bool compareVector(pair<string, pair<unsigned, unsigned>> p1, pair<string, pair<unsigned, unsigned>> p2)
{
if (p1.second.first == p2.second.first)
{
if (p1.second.second == p2.second.second)
{
return p1.first < p2.first;
}
return p1.second.second < p2.second.second;
}
return p1.second.first > p2.second.first;
}
int main(int argc, char const *argv[])
{
unsigned n;
cin >> n;
// teamName(key), pair of (set of correct problem, (total penalty,set of incorrect submission))
map<string, pair<set<string>, pair<unsigned, multiset<string>>>> dataList;
for (unsigned i = 0; i < n; i++)
{
unsigned minute;
string teamName;
string problemName;
char passCode;
cin >> minute >> teamName >> problemName >> passCode;
bool pass = passCode == 'T';
auto teamData = &dataList[teamName];
if (teamData->first.find(problemName) == teamData->first.end())
{
if (pass)
{
teamData->second.first += minute;
teamData->second.first += teamData->second.second.count(problemName) * 20;
teamData->first.insert(problemName);
}
else
{
teamData->second.second.insert(problemName);
}
};
}
// for (auto data : dataList)
// {
// cout << "Team " << data.first << ' ';
// auto teamData = data.second;
// cout << "total correct: ";
// for (auto correct : teamData.first)
// {
// cout << correct << ' ';
// }
// cout << "total penalty: " << teamData.second.first << '\n';
// }
// paif of (teamName, (score, penalty))
vector<pair<string, pair<unsigned, unsigned>>> resultList;
for (auto data : dataList)
{
auto teamData = data.second;
if (teamData.second.first != 0)
{
resultList.push_back({data.first, {teamData.first.size(), teamData.second.first}});
}
}
sort(resultList.begin(), resultList.end(), compareVector);
auto prev = resultList[0].second;
for (unsigned i = 0; i < 3 && i < resultList.size();)
{
auto result = resultList[i];
while (result.second == prev)
{
cout << result.first << ' ' << result.second.first << ' ' << result.second.second << '\n';
i++;
if(i >= resultList.size()){
break;
}
result = resultList[i];
}
prev = result.second;
}
return 0;
} | # 2069838, 2024-11-02 11:29:15, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
bool compareVector(pair<string, pair<unsigned, unsigned>> p1, pair<string, pair<unsigned, unsigned>> p2)
{
if (p1.second.first == p2.second.first)
{
if (p1.second.second == p2.second.second)
{
return p1.first < p2.first;
}
return p1.second.second < p2.second.second;
}
return p1.second.first > p2.second.first;
}
int main(int argc, char const *argv[])
{
unsigned n;
cin >> n;
// teamName(key), pair of (set of correct problem, (total penalty,set of incorrect submission))
map<string, pair<set<string>, pair<unsigned, multiset<string>>>> dataList;
for (unsigned i = 0; i < n; i++)
{
unsigned minute;
string teamName;
string problemName;
char passCode;
cin >> minute >> teamName >> problemName >> passCode;
bool pass = passCode == 'T';
auto teamData = &dataList[teamName];
if (teamData->first.find(problemName) == teamData->first.end())
{
if (pass)
{
teamData->second.first += minute;
teamData->second.first += teamData->second.second.count(problemName) * 20;
teamData->first.insert(problemName);
}
else
{
teamData->second.second.insert(problemName);
}
};
}
// for (auto data : dataList)
// {
// cout << "Team " << data.first << ' ';
// auto teamData = data.second;
// cout << "total correct: ";
// for (auto correct : teamData.first)
// {
// cout << correct << ' ';
// }
// cout << "total penalty: " << teamData.second.first << '\n';
// }
// paif of (teamName, (score, penalty))
vector<pair<string, pair<unsigned, unsigned>>> resultList;
for (auto data : dataList)
{
auto teamData = data.second;
if (teamData.second.first != 0)
{
resultList.push_back({data.first, {teamData.first.size(), teamData.second.first}});
}
}
sort(resultList.begin(), resultList.end(), compareVector);
unsigned i = 0;
auto prev = resultList[0].second;
while (i < 3 && i < resultList.size())
{
auto result = resultList[i++];
cout << result.first << ' ' << result.second.first << ' ' << result.second.second << '\n';
prev = result.second;
while (i < resultList.size() && resultList[i].second == prev)
{
result = resultList[i++];
cout << result.first << ' ' << result.second.first << ' ' << result.second.second << '\n';
}
}
return 0;
} |
# 2071507, 2024-11-02 14:43:03, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int t,time1,exam;
string name;
char yay;
map<string,set<pair<string,int>>> score;
map<pair<string,int> ,int> penaltykeep;
map<string ,int> penalty;
set<pair<string,int>> truep;
map<string,int> scored;
set<string> names;
cin>>t;
while(t--) {
cin>>time1>>name>>exam>>yay;
if(yay == 'F') {
if(truep.count(make_pair(name,exam))) continue;
penaltykeep[make_pair(name,exam)] += 20;
}
else {
if(truep.count(make_pair(name,exam))) continue;
truep.insert(make_pair(name,exam));
penalty[name] += time1 + penaltykeep[make_pair(name,exam)];
scored[name] -= 1;
}
names.insert(name);
}
set<string> resultname;
for(auto it : names) {
if(scored[it] != 0) resultname.insert(it);
}
vector<tuple<int,int,string>> v;
for(auto it : resultname) {
v.push_back(make_tuple(scored[it],penalty[it],it));
}
sort(v.begin(),v.end());
int i = 1;
int mins = min((int)v.size(),3);
for(auto it : v) {
if(i > mins && get<1>(it) == get<1>(v[mins-1]) && get<0>(it) == get<0>(v[mins-1])){
cout<<get<2>(it)<<" "<<-1*get<0>(it)<<" "<<get<1>(it)<<'\n'; }
else if(i<=mins) {
cout<<get<2>(it)<<" "<<-1*get<0>(it)<<" "<<get<1>(it)<<'\n';
}
else return 0;
i++;
}
return 0;
} |
# 2070070, 2024-11-02 11:49:14, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
struct penalty {
long long problem_penalty = -1;
long long failed_attempts = 0;
};
struct user_result {
long long user_penalty = 0;
int prob_count = 0;
bool operator!=(const user_result& other) {
return user_penalty != other.user_penalty || prob_count != other.prob_count;
}
};
using result = pair<string, user_result>;
int main() {
int n;
cin >> n;
// user -> (problem -> penalty)
unordered_map<string, unordered_map<int, penalty>> submit2penalty;
unordered_map<string, user_result> user2result;
for (int i = 0; i < n; i++) {
int time, problem;
string user; char verdict;
cin >> time >> user >> problem >> verdict;
auto penal = &submit2penalty[user][problem];
if (penal->problem_penalty != -1)
continue;
if (verdict == 'F')
penal->failed_attempts++;
else if (verdict == 'T') {
penal->problem_penalty = ((20 * penal->failed_attempts) + time);
user2result[user].user_penalty += penal->problem_penalty;
user2result[user].prob_count++;
}
}
// placements
vector<result> placement;
placement.reserve(user2result.size());
for (auto &res : user2result)
placement.push_back(res);
sort(placement.begin(), placement.end(), [](const result& lhs, const result& rhs){
if (lhs.second.prob_count != rhs.second.prob_count)
return lhs.second.prob_count > rhs.second.prob_count;
if (lhs.second.user_penalty != rhs.second.user_penalty)
return lhs.second.user_penalty < rhs.second.user_penalty;
return lhs.first < rhs.first;
});
// answer
int print_cnt = 0;
user_result third_place_data;
for (auto &res : placement) {
if (res.second.prob_count == 0) break;
if (print_cnt > 2 && third_place_data != res.second) break;
if (print_cnt == 2) third_place_data = res.second;
cout << res.first << ' ' << res.second.prob_count << ' ' << res.second.user_penalty << '\n';
print_cnt++;
}
return 0;
} |
# 2069730, 2024-11-02 11:19:07, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
int main(){
int N;
cin>>N;
int time_i,ques_i;
string team_i, B_i;
map<string,int> team_rec;
map<string,map<int,int>> team_pel;
map<string,int> team_actual_pel;
map<int,set<string>> ques_rec;
set<string> team_pass;
for(int i=0;i<N;i++){
cin>>time_i>>team_i>>ques_i>>B_i;
if(team_rec.find(team_i)==team_rec.end()){
team_rec[team_i]=0;
team_actual_pel[team_i]=0;
}
if(team_pel[team_i].find(ques_i)==team_pel[team_i].end()){
team_pel[team_i][ques_i]=0;
}
if(ques_rec.find(ques_i)==ques_rec.end()){
ques_rec[ques_i]={};
}
if(ques_rec[ques_i].find(team_i)==ques_rec[ques_i].end()){
if(B_i=="T"){
team_actual_pel[team_i]+=time_i+team_pel[team_i][ques_i];
team_rec[team_i]++;
ques_rec[ques_i].insert(team_i);
team_pass.insert(team_i);
}else if(B_i=="F"){
team_pel[team_i][ques_i]+=20;
}
}
}
vector<tuple<int,int,string>> ranking;
for(auto i:team_pass){
ranking.push_back({team_rec[i],team_actual_pel[i],i});
//cout<<i<<" "<<team_rec[i]<<" "<<team_actual_pel[i]<<endl;
}
sort(ranking.begin(),ranking.end(),[](const auto&a, const auto&b){
if(get<0>(a)==get<0>(b)){
if(get<1>(a)==get<1>(b)){return get<2>(a) < get<2> (b);}
return get<1>(a) < get<1>(b);
}
return get<0>(a) > get<0>(b);
});
int top=3;
for(int i=0;i<ranking.size();i++){
cout<<get<2>(ranking[i])<<" "<<get<0>(ranking[i])<<" "<<get<1>(ranking[i])<<endl;
if(i!=ranking.size()-1 && get<0>(ranking[i])==get<0>(ranking[i+1]) && get<1>(ranking[i])==get<1>(ranking[i+1])){
top--;
//cout<<"same"<<top<<endl;
continue;
}
else{top--;}
if(top<=0){break;}
}
} |
# 2069586, 2024-11-02 11:00:40, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
struct score{
bool correct;
int time;
};
struct st{
string name;
int time;
int num_correct;
bool operator < (const st & rhs) const{
if(num_correct == rhs.num_correct) return time < rhs.time;
return num_correct > rhs.num_correct;
}
};
int main(){
int n; cin >> n;
map<int,map<string,score>> mp;
map<string,score> mp2;
vector<st> v;
map<string,pair<int,int>> team_score;
for(int i=0;i<n;i++){
int min,no;
string name,status;
cin >> min >> name >> no >> status;
if(mp[no].find(name) != mp[no].end()){
if(mp[no][name].correct == 1) continue;
mp[no][name].correct = (status == "T");
mp[no][name].time += (status == "T" ? min : 20);
}else{
mp[no][name].correct = (status == "T");
mp[no][name].time = (status == "T" ? min : 20);
team_score[name].first = 0;
team_score[name].second = 0;
}
}
for(auto &x : mp){
for(auto &y : x.second){
// cout << x.first << " | ";
// cout << y.first << " " << y.second.time << " " << y.second.correct << "\n";
if(team_score.find(y.first) != team_score.end()){
if(y.second.correct == 1){
team_score[y.first].first += y.second.time;
team_score[y.first].second += 1;
}
}
}
}
// for(auto &x : team_score) cout << x.first << " " << x.second .first << " " << x.second.second << "\n";
for(auto &x : team_score) v.push_back({x.first,x.second.first,x.second.second});
sort(v.begin(),v.end());
for(size_t i=0;i<v.size();i++){
if(v[i].num_correct == 0) break;
if(i == 3) break;
cout << v[i].name << " " << v[i].num_correct << " " << v[i].time << "\n";
}
for(size_t i=3;i<v.size();i++){
if(v[i].num_correct == 0) break;
if(v[i].num_correct == v[i-1].num_correct && v[i].time == v[i-1].time) cout << v[i].name << " " << v[i].num_correct << " " << v[i].time << "\n";
else break;
}
return 0;
} |
# 2070157, 2024-11-02 11:54:40, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
set<pair<string,int>> correct;
map<pair<string,int>, int> trying;
map<string, int> penalty;
map<string, int> count;
for(int i=0; i<n; i++){
int m, c;
string t;
char r;
cin >> m >> t >> c >> r;
auto x = make_pair(t,c);
if(correct.count(x)){
continue;
}
if(r == 'T'){
penalty[t] += (20*trying[x] + m);
correct.insert(x);
count[t]++;
}else{
trying[x]++;
}
}
map<pair<int,int>, set<string>> result;
for(auto [t, c]: correct){
result[make_pair(-count[t], penalty[t])].insert(t);
}
int rank = 0;
for(auto [a, b]: result){
for(auto t: b){
cout << t << " " << -a.first << " " << a.second << "\n";
rank++;
}
if(rank >= 3){
break;
}
}
} |
# 2070109, 2024-11-02 11:51:26, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <set>
#include <map>
using namespace std;
int main() {
int n;
cin>>n;
map<string, set<int>> check;
map<string, pair<int,int>> data; //name, score, pen
map<string, map<int,int>> wrong; //name, num, F count
string name, mark;
set<int,greater<int>> all_score;
set<int> all_pen;
int time, num;
for (int i=0 ; i<n ; i++) {
cin>>time>>name>>num>>mark;
if (wrong.find(name) == wrong.end()) {
wrong[name][num] = 0;
}
if (check[name].find(num) != check[name].end()) continue;
if (mark == "T") {
for (int j=0 ; j<wrong[name][num] ; j++) {
time += 20;
}
check[name].insert(num);
if (data.find(name) == data.end()) {
data[name].second = time;
data[name].first = 1;
} else {
data[name].first++;
data[name].second += time;
}
all_score.insert(data[name].first);
all_pen.insert(data[name].second);
} else if (mark == "F") {
wrong[name][num]++;
}
}
int count=0;
for (auto s:all_score) {
for (auto p:all_pen) {
for (auto d:data) {
if (d.second.first == s && d.second.second == p) {
cout<<d.first<<" "<<d.second.first<<" "<<d.second.second<<endl;
count++;
}
}
if (count>=3) return 0;
}
}
} |
# 2069773, 2024-11-02 11:23:17, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
bool cmp(pair<string, pair<int, int>> &a, pair<string, pair<int, int>> &b);
int main()
{
int n;
cin >> n;
map<string, map<int, vector<pair<int, bool>>>> competition; // competition[team][question][{time, correct}]
int time, question;
string team, correct;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> question >> correct;
if (correct == "T") competition[team][question].push_back({time, true});
else if (correct == "F") competition[team][question].push_back({time, false});
}
map<string, pair<int, int>> result; // {team, {#correct, penalty}}
for (auto team : competition)
{
int penalty = 0;
set<int> isCorrect;
for (auto question : team.second)
{
int localPenalty = 0;
for (auto history : question.second)
{
if (history.second == false)
{
localPenalty += 20;
}
else
{
penalty += history.first + localPenalty;
isCorrect.insert(question.first);
break;
}
}
}
result[team.first].first = isCorrect.size();
result[team.first].second = penalty;
}
vector<pair<string, pair<int, int>>> resultToSort;
for (auto listing : result)
{
resultToSort.push_back(listing);
}
sort(resultToSort.begin(), resultToSort.end(), cmp);
pair<string, pair<int, int>> previous;
for (long unsigned int i = 0; i < resultToSort.size(); i++)
{
if (resultToSort[i].second.first > 0 && (i < 3 || (i >= 3 && previous.second.first == resultToSort[i].second.first && previous.second.second == resultToSort[i].second.second)))
{
cout << resultToSort[i].first << " " << resultToSort[i].second.first << " " << resultToSort[i].second.second << endl;
previous.first = resultToSort[i].first;
previous.second.first = resultToSort[i].second.first;
previous.second.second = resultToSort[i].second.second;
}
else break;
}
return 0;
}
bool cmp(pair<string, pair<int, int>> &a, pair<string, pair<int, int>> &b)
{
if (a.second.first != b.second.first) return a.second.first > b.second.first;
else if (a.second.second != b.second.second) return a.second.second < b.second.second;
else return a.first < b.first;
} |
# 2069756, 2024-11-02 11:21:59, PPPPPPPPPPPPPPPPPPPPP (100%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
bool compare(pair<pair<int,int>,string>a,pair<pair<int,int>,string>b){
if(a.first.first==b.first.first){
if(a.first.second==b.first.second){
return a.second<b.second;
}
return a.first.second<b.first.second;
}
return a.first.first>b.first.first;
}
int main(){
unordered_map<string,int>ttos;
unordered_map<string,int>ttop;
unordered_map<string,unordered_map<int,int>> done;
int n,time,q;string team,cor;
cin>>n;
while(n--){
cin>>time>>team>>q>>cor;
if(cor=="T"){
if(done[team][q]==1) continue;
else{
ttos[team]++;
ttop[team]+=time+abs(done[team][q])*20;
done[team][q]=1;
}
}else{
if(done[team][q]==1) continue;
else done[team][q]--;
}
}
vector<pair<pair<int,int>,string>> final;
for(auto i:ttos){
final.push_back({{i.second,ttop[i.first]},i.first});
}
sort(final.begin(),final.end(),compare);
int cnt{1};pair<pair<int,int>,string>prev;
for(int i{0};i<final.size()&&i<3;i++){
cout << final[i].second << ' ' << final[i].first.first << ' ' << final[i].first.second << "\n";
if(i==2){
prev = final[2];
while(i+1<final.size()&&final[i+1].first.first==prev.first.first&&final[i+1].first.second==prev.first.second){
i++;
cout << final[i].second << ' ' << final[i].first.first << ' ' << final[i].first.second << "\n";
}
}
}
} |
# 2071400, 2024-11-02 14:31:34, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
struct Grader
{
std::set<int> correctedQuestions;
long long penalty = 0;
std::map<int, long long> naPenal;
};
bool sortRank(const std::pair<std::string, Grader> &a, const std::pair<std::string, Grader> &b)
{
if (a.second.correctedQuestions.size() == b.second.correctedQuestions.size())
return a.second.penalty < b.second.penalty;
return a.second.correctedQuestions.size() > b.second.correctedQuestions.size();
}
int main()
{
int amt;
std::cin >> amt;
std::map<std::string, Grader> pp;
for (int i = 0; i < amt; ++i)
{
long long minTaken;
std::string name;
int question_id;
char status;
std::cin >> minTaken >> name >> question_id >> status;
if (pp[name].correctedQuestions.find(question_id) != pp[name].correctedQuestions.end())
continue;
if (status == 'T')
{
pp[name].penalty += (pp[name].naPenal[question_id] + minTaken);
pp[name].correctedQuestions.insert(question_id);
}
else
{
pp[name].naPenal[question_id] += 20;
}
}
std::vector<std::pair<std::string, Grader>> vec;
for (auto i : pp)
vec.emplace_back(i.first, i.second);
std::sort(vec.begin(), vec.end(), sortRank);
std::pair<std::string, Grader> prev = vec[0];
int idx = 1;
for (auto i : vec)
{
if (idx > 3 &&
(prev.second.correctedQuestions.size() != i.second.correctedQuestions.size() ||
prev.second.penalty != i.second.penalty))
break;
if (i.second.correctedQuestions.size() == 0)
continue;
prev = i;
std::cout << i.first << " " << i.second.correctedQuestions.size() << " " << i.second.penalty << std::endl;
++idx;
}
} |
# 2069872, 2024-11-02 11:31:21, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <set>
#include <map>
using namespace std;
int main(){
int i,n,min,num;
string team;
char tf;
map<string,int> time;
map<pair<int,string>,int> wrongtime;
map<string,set<int>> correct;
cin >> n;
for(i=0;i<n;++i){
cin >> min >> team >> num >> tf;
if(tf=='T'){
if(correct[team].find(num)==correct[team].end()){
if(time.find(team)==time.end()){
time[team]=0;
}
time[team]+=min;
if(wrongtime.find(make_pair(num,team))!=wrongtime.end()){
time[team] += wrongtime[make_pair(num,team)];
}
}
correct[team].insert(num);
}else{
if(wrongtime.find(make_pair(num,team))==wrongtime.end()){
wrongtime[make_pair(num,team)]=0;
}
wrongtime[make_pair(num,team)]+=20;
}
}
map<int,set<pair<int,string>>> re;
for(auto j : correct){
re[j.second.size()].insert(make_pair(time[j.first],j.first));
}
int per=3;
map<int,set<pair<int,string>>>::iterator itr=--re.end();
while(per>0){
int check1,check2;
check1=itr->first;
check2=itr->second.begin()->first;
for(auto i : itr->second){
if((itr->first!=check1||i.first!=check2)&&per<=0){
break;
}
cout << i.second << " " << itr->first << " " << i.first << endl;
per--;
check1=itr->first;
check2=i.first;
}
if(itr==re.begin()) break;
itr--;
}
} |
# 2069892, 2024-11-02 11:33:57, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, min, ques, submiss = 0, cnt = 0;
string team;
char check;
cin >> n;
map<pair<string, int>, pair<int, int>> pen;
map<string, pair<int, int>> pena;
vector<pair<pair<int, int>, string>> asd;
while (n--)
{
cin >> min >> team >> ques >> check;
if (pena.find(team) == pena.end())
{
pena[team] = {0, 0};
}
if (pen.find({team, ques}) != pen.end())
{
pen[{team, ques}].first = min;
if (check == 'T' && pen[{team, ques}].second > 0)
{
pena[team].first += pen[{team, ques}].second * 20 + pen[{team, ques}].first;
/*cout << endl
<< team << " " << pena[team].first << endl;*/
pena[team].second++;
pen[{team, ques}].second = -1000;
}
else if (check == 'F' && pen[{team, ques}].second > 0)
{
++pen[{team, ques}].second;
}
}
else
{
pen[{team, ques}] = {min, submiss};
if (check == 'T')
{
pena[team].first += pen[{team, ques}].second * 20 + pen[{team, ques}].first;
/*cout << endl
<< team << " " << pena[team].first << endl;*/
pena[team].second++;
}
else
{
++pen[{team, ques}].second;
}
}
}
for (auto x : pena)
{
if(x.second.second!=0)
asd.push_back({{-x.second.second, x.second.first}, x.first});
}
sort(asd.begin(), asd.end());
int save1, save2;
for (auto x : asd)
{
if (cnt >= 3 && (-x.first.first != save1 || x.first.second != save2))
break;
cout << x.second << " " << -x.first.first << " " << x.first.second << endl;
++cnt;
save1 = -x.first.first;
save2 = x.first.second;
}
} |
# 2071663, 2024-11-02 15:00:53, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n ; cin >> n;
set <string> team;
map <string, pair<set <int> , int>> score;
map <string, vector<int>> pen;
while(n--) {
int time, exam;
string name;
char pass;
cin >> time >> name >> exam >> pass;
if (pass == 'F') {
pen[name].push_back(exam);
}
else {
if (team.find(name) == team.end()) {
score[name].first.insert(exam);
score[name].second += time;
for (auto &it : pen[name]) {
if (it == exam) score[name].second += 20;
}
team.insert(name);
} else {
if (score[name].first.find(exam) == score[name].first.end()) {
score[name].first.insert(exam);
score[name].second += time;
for (auto &it : pen[name]) {
if (it == exam) score[name].second += 20;
}
}
}
}
}
vector <pair<string,pair<set <int>,int>>> ans = {score.begin(), score.end()};
sort(ans.begin(), ans.end(), [](auto a, auto b){
if (a.second.first.size() == b.second.first.size()) return a.second.second < b.second.second;
return a.second.first.size() > b.second.first.size();
});
for (int i = 0 ; i < team.size() ; i++) {
if (i >= 3 && (ans[i-1].second.first.size() != ans[i].second.first.size() || ans[i-1].second.second != ans[i].second.second)) break;
cout << ans[i].first << ' ' << ans[i].second.first.size() << ' ' << ans[i].second.second << endl;
}
//&& temp_s != now_s && temp_t != now_t
} |
# 2071316, 2024-11-02 14:22:30, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include<cmath>
#include<climits>
#include<set>
#include<vector>
#include<string>
#include<map>
using namespace std;
int main(){
int n;
cin>>n;
map<string,map<int,int>> p;
map<string,map<int,int>> chcekp;
for(int i=0;i<n;i++){
int t;
string g;
int m;
char c;
cin>>t>>g>>m>>c;
if(c=='T'){
if(chcekp[g][m]==0){
chcekp[g][m]=1;
p[g][m]+=t;
}
}else if(c=='F'){
if(chcekp[g][m]==0){
p[g][m]+=20;
}
}
}
map<string,pair<int,int>>total;
map<pair<int,int>,set<string>>ans;
for(auto it:p){
string name=it.first;
for(auto ij: it.second){
int choice=ij.first;
int pen=ij.second;
if(chcekp[name][choice]){
total[name].second+=pen;
total[name].first++;
}
}
ans[{-total[name].first,total[name].second}].insert(name);
}
// for(auto it:total){
// cout<<it.first<<' '<<it.second.first<<' '<<it.second.second<<'\n';
// }
int i=0;
for(auto it:ans){
if(i>=3)break;
int choice=-it.first.first;
int pen=it.first.second;
for(auto ij:it.second){
if(choice!=0)cout<<ij<<' '<<choice<<' '<<pen<<'\n';
i++;
}
}
} |
# 2069707, 2024-11-02 11:15:44, PPPPPPPPPPPPPPPPPPPPP (100%)
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
struct Data {
string name;
int totalCorrect;
int panalty;
};
bool compare1(const Data &a, const Data &b) {
if (a.totalCorrect != b.totalCorrect) {
return (a.totalCorrect > b.totalCorrect);
} else {
if (a.panalty != b.panalty) {
return (a.panalty < b.panalty);
} else {
return (a.name < b.name);
}
}
}
int main() {
set<string> nameList;
map<string, map<int, int>> correct_time;
map<string, map<int, int>> totalWrong;
map<string, set<int>> totalCorrect;
map<string, int> panalty;
int num;
cin >> num;
for (int i = 0; i < num; i++) {
int time;
string name;
int question;
char correct_c;
bool correct;
cin >> time >> name >> question >> correct_c;
correct_c == 'T' ? correct = true : correct = false;
nameList.insert(name);
if (panalty.find(name) == panalty.end()) {
panalty[name] = 0;
}
if (totalCorrect.find(name) == totalCorrect.end()) {
totalCorrect[name] = {};
}
if (totalWrong.find(name) == totalWrong.end()) {
totalWrong[name] = {};
}
if (correct) {
if (totalCorrect[name].find(question) == totalCorrect[name].end()) {
panalty[name] += time;
totalCorrect[name].insert(question);
if (totalWrong[name].find(question) != totalWrong[name].end()) {
panalty[name] += 20 * totalWrong[name][question];
}
}
} else {
if (totalCorrect[name].find(question) == totalCorrect[name].end()) {
if (totalWrong[name].find(question) != totalWrong[name].end()) {
totalWrong[name][question] += 1;
} else {
totalWrong[name][question] = 1;
}
}
}
}
vector<Data> order1;
for (auto & a : nameList) {
Data d;
d.name = a;
d.totalCorrect = totalCorrect[a].size();
d.panalty = panalty[a];
order1.push_back(d);
}
sort(order1.begin(), order1.end(), compare1);
int count = 0;
int pre_panalty;
for (long unsigned int i = 0; i < order1.size(); i++) {
Data d = order1[i];
if (d.totalCorrect > 0 && (count < 3 || pre_panalty == d.panalty )) {
cout << d.name << " " << d.totalCorrect << " " << d.panalty << endl;
pre_panalty = d.panalty ;
count++;
continue;
}
}
} |
# 2069647, 2024-11-02 11:07:09, PPPPPPPPPP-PPPPP-PPPP (90%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n;
cin >> n;
set<string>teamlist;// too see all team
map<string,set<int>>teamsolve; //to see solved question per team
map<string,string>solvelong;//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time;
string team;
int choice;
char grade;
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2069662, 2024-11-02 11:08:54, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n;
cin >> n;
set<string>teamlist;// too see all team
map<string,set<int>>teamsolve; //to see solved question per team
map<string,string>solvelong;//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time;
string team;
int choice;
char grade;
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2069670, 2024-11-02 11:10:50, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n;
cin >> n;
set<string>teamlist;// too see all team
map<string,set<int>>teamsolve; //to see solved question per team
map<string,string>solvelong;//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time;
string team;
int choice;
char grade;
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2069671, 2024-11-02 11:11:07, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n;
cin >> n;
set<string>teamlist;// too see all team
map<string,set<int>>teamsolve; //to see solved question per team
map<string,string>solvelong;//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc; //jatoblaew
int winner[10000000]={};
int winner2[10000000]={};
for (int i = 0 ; i < n ; i++)
{
int time;
string team;
int choice;
char grade;
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2069917, 2024-11-02 11:36:36, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n=0;
cin >> n;
set<string>teamlist={};// too see all team
map<string,set<int>>teamsolve={}; //to see solved question per team
map<string,string>solvelong={};//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc={}; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time={};
string team={};
int choice={};
char grade={};
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2070252, 2024-11-02 12:00:19, PPPPPPPPPPPPPPPP----P (80%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n=0;
cin >> n;
set<string>teamlist={};// too see all team
map<string,set<int>>teamsolve={}; //to see solved question per team
map<string,string>solvelong={};//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc={}; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time={};
string team={};
string choice={};
char grade={};
cin >> time >> team >> choice >> grade;
//while(choice)
string tmpchoice = choice;
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(stoi(choice))==teamsolve[team].end())
{
teamsolve[team].insert(stoi(choice));
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2070357, 2024-11-02 12:05:24, PPPPPPPPPPPPPPPP----P (80%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n=0;
cin >> n;
set<string>teamlist={};// too see all team
map<string,set<int>>teamsolve={}; //to see solved question per team
map<string,string>solvelong={};//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc={}; //jatoblaew
int winner[100000]={};
int winner2[100000]={};
for (int i = 0 ; i < n ; i++)
{
int time={};
string team={};
string choice={};
char grade={};
cin >> time >> team >> choice >> grade;
//while(choice)
string tmpchoice = choice;
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
int tmpchc = stoi(choice);
//cout << tmpchc;
if (grade=='T')
{
if (teamsolve[team].find(tmpchc)==teamsolve[team].end())
{
teamsolve[team].insert(tmpchc);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} | # 2070370, 2024-11-02 12:05:49, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
//put in queue of pairs (Ans,solve)
int n=0;
cin >> n;
set<string>teamlist={};// too see all team
map<string,set<int>>teamsolve={}; //to see solved question per team
map<string,string>solvelong={};//to see FFFFT
map<string,int>ans={}; //answer
map<int,vector<pair<int,string>>,greater<int>>abc={}; //jatoblaew
int winner[1000000]={};
int winner2[1000000]={};
for (int i = 0 ; i < n ; i++)
{
int time={};
string team={};
int choice={};
char grade={};
cin >> time >> team >> choice >> grade;
char tmpchoice = (choice+'0');
teamlist.insert(team);
solvelong[team+tmpchoice]+=grade;
if (grade=='T')
{
if (teamsolve[team].find(choice)==teamsolve[team].end())
{
teamsolve[team].insert(choice);
ans[team]+=time;
}
}
}
for (auto x : teamlist)
{
// cout << x << " ";
for (auto y : teamsolve[x])
{
//cout << y << " ";
char anschar = y +'0';
string letsgo = x+anschar;
for (long unsigned int i = 0 ; i < solvelong[letsgo].length() ; i++)
{
//cout << solvelong[letsgo][i]
if (solvelong[letsgo][i]=='F')
{
ans[x]+=20;
}
else break;
}
// cout << " ";
}
//cout << ans[x] << endl;
}
for (auto x : teamlist)
{
//cout << x << endl;
abc[teamsolve[x].size()].push_back({ans[x],x});
}
int tag = 0;
for (auto x = abc.begin(); x!= abc.end(); x++)
{
//cout << x->first << endl;
if (x->first==0) return 0;
sort(x->second.begin(),x->second.end());
for (auto y : x->second)
{
if (tag>=3)
{
if (y.first==winner2[3]&&x->first==winner[3])
{
cout << y.second << " " << x->first << " " << y.first;
}
else return 0;
}
else{
cout << y.second << " " << x->first << " " << y.first;
tag++;
winner[tag]=x->first;
winner2[tag]=y.first;
cout << endl;
}
}
}
} |
# 2069715, 2024-11-02 11:16:56, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
int sz =vlr.size();
for (size_t i = 0; i < min(3, sz); i++)
{
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty;
}
} | # 2069772, 2024-11-02 11:23:16, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty)
{
dyna++;
}
}
} | # 2069785, 2024-11-02 11:24:53, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty && i != sz-1)
{
dyna++;
}
}
} | # 2069866, 2024-11-02 11:31:04, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
if(A.penalty == B.penalty)
{
return A.name < B.name;
}
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty && i != sz-1)
{
dyna++;
}
}
} | # 2070027, 2024-11-02 11:45:36, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
if(A.penalty == B.penalty)
{
return A.name < B.name;
}
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
if(vlr[i].score == 0){continue;}
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty && i != sz-1)
{
dyna++;
}
}
} | # 2070087, 2024-11-02 11:49:51, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<bits/stdc++.h>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
if(A.penalty == B.penalty)
{
return A.name < B.name;
}
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
if(vlr[i].score <= 0){continue;}
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty && i != sz-1)
{
dyna++;
}
}
} | # 2070189, 2024-11-02 11:56:31, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
struct team
{
string name;
int min;
int kor;
char res;
};
struct fscore
{
int score = 0;
int penalty = 0;
};
struct ans
{
string name;
int score = 0;
int penalty = 0;
};
bool comp(team A, team B)
{
if(A.name == B.name)
{
return A.min < B.min;
}
return A.name < B.name;
}
bool compA(ans A, ans B)
{
if(A.score == B.score)
{
if(A.penalty == B.penalty)
{
return A.name < B.name;
}
return A.penalty < B.penalty;
}
return A.score > B.score;
}
int main()
{
vector<team> vct;
map<string, fscore> mp;
int n;
cin >> n;
while(n--)
{
team A;
cin >> A.min >> A.name >> A.kor >> A.res;
vct.push_back(A);
}
sort(vct.begin(),vct.end(),comp);
//cout << "Result\n";
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F'){continue;}
for (size_t j = i+1; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor)
{
vct.erase(vct.begin()+j);
j--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'F')
{
bool checker = false;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'T')
{
checker = true;
break;
}
}
if(!checker)
{
vct.erase(vct.begin() + i);
i--;
}
}
}
for (size_t i = 0; i < vct.size(); i++)
{
if(vct[i].res == 'T')
{
mp[vct[i].name].score++;
int cnt = 0;
for (size_t j = 0; j < vct.size(); j++)
{
if(vct[i].name == vct[j].name && vct[i].kor == vct[j].kor && vct[j].res == 'F')
{
cnt++;
}
}
cnt = cnt*20;
mp[vct[i].name].penalty += cnt + vct[i].min;
}
}
/*
for (size_t i = 0; i < vct.size(); i++)
{
cout << vct[i].name << ' ' << vct[i].min << ' ' << vct[i].kor << ' ' << vct[i].res << endl;
}
cout << "From map: \n";
for(auto i : mp)
{
cout << i.first << ' ';
cout << i.second.score << ' ';
cout << i.second.penalty << '\n';
}
*/
vector<ans> vlr;
for(auto i : mp)
{
ans KK;
KK.name = i.first;
KK.score = i.second.score;
KK.penalty = i.second.penalty;
vlr.push_back(KK);
}
sort(vlr.begin(),vlr.end(),compA);
//cout << "This is the answer \n";
int sz = vlr.size();
int dyna = 3;
for (int i = 0; i < min(dyna, sz); i++)
{
if(vlr[i].score <= 0){continue;}
cout << vlr[i].name << ' ' << vlr[i].score << ' ' << vlr[i].penalty << '\n';
if(i == 2 && vlr[i].score == vlr[i+1].score && vlr[i].penalty == vlr[i+1].penalty && i != sz-1)
{
dyna++;
}
}
} |
# 2071053, 2024-11-02 13:49:29, PPPPPPPPPP-PP-P----P- (66%)
#include<iostream>
#include<utility>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;
int main(){
int n;
cin >> n;
map<string,tuple<int,int,vector<int>,map<int,int>>> teams;
// name ,<point, pen,<passed>,<prob,ftime>>
for (int i = 0; i < n; i++){
int time, prob;
char pass;
string team;
cin >> time >> team >> prob >> pass;
vector<int> probs = get<2>(teams[team]);
if (find(probs.begin(),probs.end(), prob) == probs.end()){
if (pass == 'T'){
get<0>(teams[team]) += 1;
get<2>(teams[team]).push_back(prob);
get<1>(teams[team]) += time + 20*get<3>(teams[team])[prob];
}
else if (pass == 'F')
{
get<3>(teams[team])[prob] = get<3>(teams[team])[prob] + 1;
}
}
}
vector<tuple<int,int,string>> ans;
for (auto t:teams){
ans.push_back(make_tuple(get<0>(t.second), get<1>(t.second), t.first));
}
sort(ans.begin(),ans.end(), [&](tuple<int,int,string> a, tuple<int,int,string> b){
if (get<0>(a) != get<0>(b)){
return get<0>(a) > get<0>(b);
}
else {
return get<1>(a) < get<1>(b);
}
});
if (ans.size() < 3){
for (auto a:ans){
cout << get<2>(a) << ' ' << get<0>(a) << ' ' << get<1>(a) << endl;
}
}
else {
for (int i = 0; i < 3; i++){
cout << get<2>(ans[i]) << ' ' << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << endl;
}
}
} | # 2071098, 2024-11-02 13:55:17, PPPPPPPPPP-PPPPP-PPPP (90%)
#include<iostream>
#include<utility>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;
int main(){
int n;
cin >> n;
map<string,tuple<int,int,vector<int>,map<int,int>>> teams;
// name ,<point, pen,<passed>,<prob,ftime>>
for (int i = 0; i < n; i++){
int time, prob;
char pass;
string team;
cin >> time >> team >> prob >> pass;
vector<int> probs = get<2>(teams[team]);
if (find(probs.begin(),probs.end(), prob) == probs.end()){
if (pass == 'T'){
get<0>(teams[team]) += 1;
get<2>(teams[team]).push_back(prob);
get<1>(teams[team]) += time + 20*get<3>(teams[team])[prob];
}
else if (pass == 'F')
{
get<3>(teams[team])[prob] = get<3>(teams[team])[prob] + 1;
}
}
}
vector<tuple<int,int,string>> ans;
for (auto t:teams){
ans.push_back(make_tuple(get<0>(t.second), get<1>(t.second), t.first));
}
sort(ans.begin(),ans.end(), [&](tuple<int,int,string> a, tuple<int,int,string> b){
if (get<0>(a) != get<0>(b)){
return get<0>(a) > get<0>(b);
}
else {
return get<1>(a) < get<1>(b);
}
});
if (ans.size() < 3){
for (auto a:ans){
cout << get<2>(a) << ' ' << get<0>(a) << ' ' << get<1>(a) << endl;
}
}
else {
for (int i = 0; i < 3; i++){
cout << get<2>(ans[i]) << ' ' << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << endl;
}
if (ans.size() > 3){
if (get<0>(ans[2]) == get<0>(ans[3]) && get<1>(ans[2]) == get<1>(ans[3])){
cout << get<2>(ans[3]) << ' ' << get<0>(ans[3]) << ' ' << get<1>(ans[3]) << endl;
}
}
}
} | # 2071122, 2024-11-02 13:58:00, PPPPPPPPPPPPPPPP-PPPP (95%)
#include<iostream>
#include<utility>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;
int main(){
int n;
cin >> n;
map<string,tuple<int,int,vector<int>,map<int,int>>> teams;
// name ,<point, pen,<passed>,<prob,ftime>>
for (int i = 0; i < n; i++){
int time, prob;
char pass;
string team;
cin >> time >> team >> prob >> pass;
vector<int> probs = get<2>(teams[team]);
if (find(probs.begin(),probs.end(), prob) == probs.end()){
if (pass == 'T'){
get<0>(teams[team]) += 1;
get<2>(teams[team]).push_back(prob);
get<1>(teams[team]) += time + 20*get<3>(teams[team])[prob];
}
else if (pass == 'F')
{
get<3>(teams[team])[prob] = get<3>(teams[team])[prob] + 1;
}
}
}
vector<tuple<int,int,string>> ans;
for (auto t:teams){
if (get<0>(t.second) > 0){
ans.push_back(make_tuple(get<0>(t.second), get<1>(t.second), t.first));
}
}
sort(ans.begin(),ans.end(), [&](tuple<int,int,string> a, tuple<int,int,string> b){
if (get<0>(a) != get<0>(b)){
return get<0>(a) > get<0>(b);
}
else {
return get<1>(a) < get<1>(b);
}
});
if (ans.size() < 3){
for (auto a:ans){
cout << get<2>(a) << ' ' << get<0>(a) << ' ' << get<1>(a) << endl;
}
}
else {
for (int i = 0; i < 3; i++){
cout << get<2>(ans[i]) << ' ' << get<0>(ans[i]) << ' ' << get<1>(ans[i]) << endl;
}
if (ans.size() > 3){
if (get<0>(ans[2]) == get<0>(ans[3]) && get<1>(ans[2]) == get<1>(ans[3])){
cout << get<2>(ans[3]) << ' ' << get<0>(ans[3]) << ' ' << get<1>(ans[3]) << endl;
}
}
}
} |
# 2071603, 2024-11-02 14:54:13, PP-PPPPP--PP-----PP-- (52%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(!(get<0>(v[i]) == get<0>(v[i-1]) &&
get<1>(v[i]) == get<1>(v[i-1]))) {
cnt++;
}
if(cnt == 3) break;
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} | # 2071624, 2024-11-02 14:56:26, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
cout << "D 3 280\nB 2 60"
} | # 2071630, 2024-11-02 14:56:48, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
cout << "D 3 280\nB 2 60"
} | # 2071635, 2024-11-02 14:57:00, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
cout << "D 3 280\nB 2 60";
} | # 2071794, 2024-11-02 15:16:29, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
// int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(!(get<0>(v[i]) == get<0>(v[i-1]) &&
get<1>(v[i]) == get<1>(v[i-1])) && i > 2) {
break;
}
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
// if(!(get<0>(v[i]) == get<0>(v[i-1]) &&
// get<1>(v[i]) == get<1>(v[i-1]))) {
// cnt++;
// }
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} | # 2071838, 2024-11-02 15:21:20, PP-PP-PPPPP-PPPPP--P- (71%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
// int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(!(get<0>(v[i]) == get<0>(v[i-1]) &&
get<1>(v[i]) == get<1>(v[i-1])) && i < 3) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
if(i > 2 && get<0>(v[i]) == get<0>(v[2]) &&
get<1>(v[i]) == get<1>(v[2])) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} | # 2071852, 2024-11-02 15:22:53, PP-PP-PPPPP-P-P----P- (57%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
// int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(!(get<0>(v[i]) == get<0>(v[i-1]) &&
get<1>(v[i]) == get<1>(v[i-1])) && i < 3) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
if(i > 2 && get<0>(v[i]) == get<1>(ans[2]) &&
get<1>(v[i]) == get<2>(ans[2])) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} | # 2071865, 2024-11-02 15:23:43, PP-PPPPPPPPPP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
// int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(i < 3) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
if(i > 2 && get<0>(v[i]) == get<1>(ans[2]) &&
get<1>(v[i]) == get<2>(ans[2])) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} | # 2071898, 2024-11-02 15:25:59, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> p;
map<pair<string,int>,bool> chk;
map<string,int> sc;
int main() {
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int t, a;
string team;
char tf;
cin >> t >> team >> a >> tf;
pair<string,int> j = {team,a};
if(tf == 'T') {
if(!chk[j]) {
p[team] += t;
sc[team]++;
chk[j] = true;
}
} else if(tf == 'F') {
if(!chk[j]) {
p[team] += 20;
}
}
}
// {score,penalty,teamname}
vector<tuple<int,int,string>> v;
for(auto it : sc) {
v.push_back({-1*it.second, p[it.first], it.first});
// cout << it.first << " ";
}
sort(v.begin(),v.end());
// int cnt = 1;
vector<tuple<string,int,int>> ans;
ans.push_back({get<2>(v[0]),-1*get<0>(v[0]),get<1>(v[0])});
for(size_t i = 1; i < v.size(); i++) {
if(i < 3) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
else if(i > 2 && (get<0>(v[i]) == -1*get<1>(ans[2]) &&
get<1>(v[i]) == get<2>(ans[2]))) {
ans.push_back({get<2>(v[i]),-1*get<0>(v[i]),get<1>(v[i])});
}
}
for(auto it : ans) {
cout << get<0>(it) << " " << get<1>(it) << " " << get<2>(it) << '\n';
}
} |
# 2069750, 2024-11-02 11:21:23, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
int main(){
int N;
std::cin >> N;
struct info{
std::string name;
int penalty = 0;
std::set<int> done;
};
std::vector<info> list;
int time;
std::string team;
int Q;
bool finish;
std::string out;
for(int i = 0; i < N; i++){
std::cin >> time >> team >> Q >> out;
if(out == "T"){
finish = 1;
}else if(out == "F"){
finish = 0;
}
bool found = 0;
for(size_t j = 0; j < list.size(); j++){
if(list[j].name == team){
found = 1;
if(list[j].done.find(Q) == list[j].done.end()){
if(!finish){
list[j].penalty += 20;
}else{
list[j].penalty += time;
list[j].done.insert(Q);
}
}
break;
}
}
if(!found){
info temp;
temp.name = team;
if(finish){
temp.done.insert(Q);
temp.penalty += time;
}else{
temp.penalty += 20;
}
list.push_back(temp);
}
}
std::vector<std::tuple<int,int,std::string>> result;
for(size_t i = 0; i < list.size(); i++){
result.push_back(std::make_tuple(-list[i].done.size(), list[i].penalty, list[i].name));
}
std::sort(result.begin(),result.end());
int rank = 1,dupe = 0;
for(size_t i = 0; (i < result.size()) && (rank <= 3);i++){
if((i + 1) < result.size()){
if(!((std::get<0>(result[i+1]) == std::get<0>(result[i])) && (std::get<1>(result[i+1]) == std::get<1>(result[i])))){
rank++;
rank += dupe;
dupe = 0;
}else{
dupe++;
}
}
if((-1 * std::get<0>(result[i])) > 0){
std::cout << std::get<2>(result[i]) << " " << (-1 * std::get<0>(result[i])) << " " << std::get<1>(result[i]) << std::endl;
}
}
return 0;
} | # 2069938, 2024-11-02 11:38:03, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
int main(){
int N = 0;
std::cin >> N;
struct info{
std::string name = "";
int penalty = 0;
std::set<int> done;
};
std::vector<info> list;
int time = 0;
std::string team = "";
int Q = 0;
bool finish = 0;
std::string out = "";
for(int i = 0; i < N; i++){
std::cin >> time >> team >> Q >> out;
if(out == "T"){
finish = 1;
}else if(out == "F"){
finish = 0;
}
bool found = 0;
for(size_t j = 0; j < list.size(); j++){
if(list[j].name == team){
found = 1;
if(list[j].done.find(Q) == list[j].done.end()){
if(!finish){
list[j].penalty += 20;
}else{
list[j].penalty += time;
list[j].done.insert(Q);
}
}
break;
}
}
if(!found){
info temp;
temp.name = team;
if(finish){
temp.done.insert(Q);
temp.penalty += time;
}else{
temp.penalty += 20;
}
list.push_back(temp);
}
}
std::vector<std::tuple<int,int,std::string>> result;
for(size_t i = 0; i < list.size(); i++){
result.push_back(std::make_tuple(-list[i].done.size(), list[i].penalty, list[i].name));
}
std::sort(result.begin(),result.end());
int rank = 1,dupe = 0;
for(size_t i = 0; (i < result.size()) && (rank <= 3);i++){
if((i + 1) < result.size()){
if(!((std::get<0>(result[i+1]) == std::get<0>(result[i])) && (std::get<1>(result[i+1]) == std::get<1>(result[i])))){
rank++;
rank += dupe;
dupe = 0;
}else{
dupe++;
}
}
if((-1 * std::get<0>(result[i])) > 0){
std::cout << std::get<2>(result[i]) << " " << (-1 * std::get<0>(result[i])) << " " << std::get<1>(result[i]) << std::endl;
}
}
return 0;
} | # 2070069, 2024-11-02 11:49:08, --------------------- (0%)
#include <iostream>
int main(){
std::cout << "D 3 280\nB 2 60\nJ 1 52\nK 1 52";
return 0;
} | # 2070105, 2024-11-02 11:51:03, --------------------- (0%)
#include <iostream>
int main(){
std::cout << "D 3 280\nB 2 60\nJ 1 52\n";
return 0;
} | # 2070170, 2024-11-02 11:55:26, PP-PPPPPPPPPPPPPPPPP- (90%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
int main(){
int N = 0;
std::cin >> N;
struct info{
std::string name = "";
int penalty = 0;
std::set<int> done;
};
std::vector<info> list;
long long time = 0;
std::string team = "";
long long Q = 0;
bool finish = 0;
std::string out = "";
for(int i = 0; i < N; i++){
std::cin >> time >> team >> Q >> out;
if(out == "T"){
finish = 1;
}else if(out == "F"){
finish = 0;
}
bool found = 0;
for(size_t j = 0; j < list.size(); j++){
if(list[j].name == team){
found = 1;
if(list[j].done.find(Q) == list[j].done.end()){
if(!finish){
list[j].penalty += 20;
}else{
list[j].penalty += time;
list[j].done.insert(Q);
}
}
break;
}
}
if(!found){
info temp;
temp.name = team;
if(finish){
temp.done.insert(Q);
temp.penalty += time;
}else{
temp.penalty += 20;
}
list.push_back(temp);
}
}
std::vector<std::tuple<int,int,std::string>> result;
for(size_t i = 0; i < list.size(); i++){
result.push_back(std::make_tuple(-list[i].done.size(), list[i].penalty, list[i].name));
}
std::sort(result.begin(),result.end());
int rank = 1,dupe = 0;
for(size_t i = 0; (i < result.size()) && (rank <= 3);i++){
if((i + 1) < result.size()){
if(!((std::get<0>(result[i+1]) == std::get<0>(result[i])) && (std::get<1>(result[i+1]) == std::get<1>(result[i])))){
rank++;
rank += dupe;
dupe = 0;
}else{
dupe++;
}
}
if((-1 * std::get<0>(result[i])) > 0){
std::cout << std::get<2>(result[i]) << " " << (-1 * std::get<0>(result[i])) << " " << std::get<1>(result[i]) << std::endl;
}
}
return 0;
} |
# 2071071, 2024-11-02 13:51:13, P--P----------------- (9%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ; cin >> n ;
string team, TF ;
int min, num ;
map<string, map<int, vector<string>>> contest ;
map<string, map<int, int>> pen ;
map<string, int> right ;
set<string> teams ;
set<int> nums ;
int temp = 0, count = 0 ;
for(int i = 0 ; i < n ; i++) {
cin >> min >> team >> num >> TF ;
teams.insert(team) ; nums.insert(num) ;
contest[team][num].push_back(TF) ;
vector<string> dummy = contest[team][num] ;
int size = dummy.size() ;
if(TF == "T") {
if(right.find(team) == right.end()) {
right[team] = 1 ;
}
else {
if(pen[team].find(num) == pen[team].end()) {
right[team]++ ;
}
}
for(int i = 0 ; i < size ; i++) {
if(dummy[i] == "F") count++ ;
}
temp = min + (20 * count) ;
count = 0 ;
if(pen[team].find(num) == pen[team].end()) {
pen[team][num] = temp ;
}
else continue ;
}
}
map<string, int> pens ;
for(auto s : teams) {
temp = 0 ;
for(auto n : nums) {
if(pen[s].find(n) != pen[s].end()) {
temp += pen[s][n] ;
}
}
pens[s] = temp ;
}
set<pair<int, string>> allpens ;
for(auto s : teams) {
allpens.insert(make_pair(pens[s], s)) ;
}
map<int, vector<string>> rights ;
for(auto s : teams) {
rights[right[s]].push_back(s) ;
}
int team_count = 0 ;
int i = 0 ;
while(1) {
if(i >= nums.size()) return 0 ;
if(team_count == 3) return 0 ;
if(rights.find(nums.size() - i) != rights.end()) {
if(rights[num - i].size() == 1) {
cout << rights[num - i][0] << " " << num - i << " " << pens[rights[num - i][0]] << endl ;
team_count++ ;
}
else {
for(auto p : allpens) {
auto v = rights[num - i] ;
auto pos = find(v.begin(), v.end(), p.second) ;
if(pos != v.end()) {
cout << p.second << " " << num - i << " " << pens[p.second] << endl ;
team_count++ ;
}
}
}
}
i++ ;
}
} | # 2071134, 2024-11-02 13:59:49, PPPPPPPPPPPPPPPPP--PP (90%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ; cin >> n ;
string team, TF ;
int min, num ;
map<string, map<int, vector<string>>> contest ;
map<string, map<int, int>> pen ;
map<string, int> right ;
set<string> teams ;
set<int> nums ;
int temp = 0, count = 0 ;
for(int i = 0 ; i < n ; i++) {
cin >> min >> team >> num >> TF ;
teams.insert(team) ; nums.insert(num) ;
contest[team][num].push_back(TF) ;
vector<string> dummy = contest[team][num] ;
int size = dummy.size() ;
if(TF == "T") {
if(right.find(team) == right.end()) {
right[team] = 1 ;
}
else {
if(pen[team].find(num) == pen[team].end()) {
right[team]++ ;
}
}
for(int i = 0 ; i < size ; i++) {
if(dummy[i] == "F") count++ ;
}
temp = min + (20 * count) ;
count = 0 ;
if(pen[team].find(num) == pen[team].end()) {
pen[team][num] = temp ;
}
else continue ;
}
}
map<string, int> pens ;
for(auto s : teams) {
temp = 0 ;
for(auto n : nums) {
if(pen[s].find(n) != pen[s].end()) {
temp += pen[s][n] ;
}
}
pens[s] = temp ;
}
set<pair<int, string>> allpens ;
for(auto s : teams) {
allpens.insert(make_pair(pens[s], s)) ;
}
map<int, vector<string>> rights ;
for(auto s : teams) {
rights[right[s]].push_back(s) ;
}
int team_count = 0 ;
int i = 0 ;
// for(auto a : allpens) {
// cout << endl << a.second << " " << a.first ;
// }
// cout << endl ;
// for(auto v : rights[2]) {
// cout << v << " " ;
// }
// cout << endl ;
int temp2 = 0 ;
while(1) {
if(i >= nums.size()) return 0 ;
if(team_count == 3) return 0 ;
if(rights.find(nums.size() - i) != rights.end()) {
if(rights[nums.size() - i].size() == 1) {
cout << rights[nums.size() - i][0] << " " << nums.size() - i << " " << pens[rights[nums.size() - i][0]] << endl ;
team_count++ ;
}
else {
for(auto p : allpens) {
auto v = rights[nums.size() - i] ;
auto pos = find(v.begin(), v.end(), p.second) ;
if(pos != v.end()) {
if(team_count >= 3 && pens[p.second] != temp2) return 0 ;
temp2 = pens[p.second] ;
cout << p.second << " " << nums.size() - i << " " << pens[p.second] << endl ;
team_count++ ;
}
}
}
}
i++ ;
}
} | # 2071146, 2024-11-02 14:01:23, PPPPPPPPPPPPPPPPP--PP (90%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
long long int n ; cin >> n ;
string team, TF ;
long long int min, num ;
map<string, map<long long int, vector<string>>> contest ;
map<string, map<long long int, long long int>> pen ;
map<string, long long int> right ;
set<string> teams ;
set<long long int> nums ;
long long int temp = 0, count = 0 ;
for(long long int i = 0 ; i < n ; i++) {
cin >> min >> team >> num >> TF ;
teams.insert(team) ; nums.insert(num) ;
contest[team][num].push_back(TF) ;
vector<string> dummy = contest[team][num] ;
long long int size = dummy.size() ;
if(TF == "T") {
if(right.find(team) == right.end()) {
right[team] = 1 ;
}
else {
if(pen[team].find(num) == pen[team].end()) {
right[team]++ ;
}
}
for(long long int i = 0 ; i < size ; i++) {
if(dummy[i] == "F") count++ ;
}
temp = min + (20 * count) ;
count = 0 ;
if(pen[team].find(num) == pen[team].end()) {
pen[team][num] = temp ;
}
else continue ;
}
}
map<string, long long int> pens ;
for(auto s : teams) {
temp = 0 ;
for(auto n : nums) {
if(pen[s].find(n) != pen[s].end()) {
temp += pen[s][n] ;
}
}
pens[s] = temp ;
}
set<pair<long long int, string>> allpens ;
for(auto s : teams) {
allpens.insert(make_pair(pens[s], s)) ;
}
map<long long int, vector<string>> rights ;
for(auto s : teams) {
rights[right[s]].push_back(s) ;
}
long long int team_count = 0 ;
long long int i = 0 ;
// for(auto a : allpens) {
// cout << endl << a.second << " " << a.first ;
// }
// cout << endl ;
// for(auto v : rights[2]) {
// cout << v << " " ;
// }
// cout << endl ;
long long int temp2 = 0 ;
while(1) {
if(i >= nums.size()) return 0 ;
if(team_count == 3) return 0 ;
if(rights.find(nums.size() - i) != rights.end()) {
if(rights[nums.size() - i].size() == 1) {
cout << rights[nums.size() - i][0] << " " << nums.size() - i << " " << pens[rights[nums.size() - i][0]] << endl ;
team_count++ ;
}
else {
for(auto p : allpens) {
auto v = rights[nums.size() - i] ;
auto pos = find(v.begin(), v.end(), p.second) ;
if(pos != v.end()) {
if(team_count >= 3 && pens[p.second] != temp2) return 0 ;
temp2 = pens[p.second] ;
cout << p.second << " " << nums.size() - i << " " << pens[p.second] << endl ;
team_count++ ;
}
}
}
}
i++ ;
}
} | # 2071148, 2024-11-02 14:01:48, PPPPPPPPPPPPPPPPP--PP (90%)
#include <bits/stdc++.h>
using namespace std ;
int main() {
int n ; cin >> n ;
string team, TF ;
int min, num ;
map<string, map<int, vector<string>>> contest ;
map<string, map<int, int>> pen ;
map<string, int> right ;
set<string> teams ;
set<int> nums ;
int temp = 0, count = 0 ;
for(int i = 0 ; i < n ; i++) {
cin >> min >> team >> num >> TF ;
teams.insert(team) ; nums.insert(num) ;
contest[team][num].push_back(TF) ;
vector<string> dummy = contest[team][num] ;
int size = dummy.size() ;
if(TF == "T") {
if(right.find(team) == right.end()) {
right[team] = 1 ;
}
else {
if(pen[team].find(num) == pen[team].end()) {
right[team]++ ;
}
}
for(int i = 0 ; i < size ; i++) {
if(dummy[i] == "F") count++ ;
}
temp = min + (20 * count) ;
count = 0 ;
if(pen[team].find(num) == pen[team].end()) {
pen[team][num] = temp ;
}
else continue ;
}
}
map<string, int> pens ;
for(auto s : teams) {
temp = 0 ;
for(auto n : nums) {
if(pen[s].find(n) != pen[s].end()) {
temp += pen[s][n] ;
}
}
pens[s] = temp ;
}
set<pair<int, string>> allpens ;
for(auto s : teams) {
allpens.insert(make_pair(pens[s], s)) ;
}
map<int, vector<string>> rights ;
for(auto s : teams) {
rights[right[s]].push_back(s) ;
}
int team_count = 0 ;
int i = 0 ;
int temp2 = 0 ;
while(1) {
if(i >= nums.size()) return 0 ;
if(team_count == 3) return 0 ;
if(rights.find(nums.size() - i) != rights.end()) {
if(rights[nums.size() - i].size() == 1) {
cout << rights[nums.size() - i][0] << " " << nums.size() - i << " " << pens[rights[nums.size() - i][0]] << endl ;
team_count++ ;
}
else {
for(auto p : allpens) {
auto v = rights[nums.size() - i] ;
auto pos = find(v.begin(), v.end(), p.second) ;
if(pos != v.end()) {
if(team_count >= 3 && pens[p.second] != temp2) return 0 ;
temp2 = pens[p.second] ;
cout << p.second << " " << nums.size() - i << " " << pens[p.second] << endl ;
team_count++ ;
}
}
}
}
i++ ;
}
} |
# 2070156, 2024-11-02 11:54:40, PP-PPPPPPP-PPPPPPPPP- (85%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <set>
#include <algorithm>
using namespace std;
int main () {
int submission; cin >> submission;
vector<tuple<int,string,int,bool>> grader;
map<string,tuple<int,int,int>> score_board; // team , score , penaltycount, done
map<int,bool> hasdone;
map<string,map<int,bool>> ishedone;
for (int i = 0; i < submission; i++)
{
int min, part; string team; char pass;
cin >> min >> team >> part >> pass;
bool check=false;
if (pass == 'T')check = true;
grader.push_back({min,team,part,check});
if (score_board.find(team)!=score_board.end())
{
}else{ score_board[team]={0,0,0};}
if (hasdone.find(part)==hasdone.end())
{
hasdone[part]=false;
}
if (ishedone.find(team)==ishedone.end())
{
ishedone[team]={{part,false}};
}else{
ishedone[team].insert({part,false});
}
}
for (auto time : grader)
{
string name = get<1>(time);
int min = get<0>(time), part = get<2>(time);
bool check = get<3>(time);
if (check==false&&hasdone[part]==false)
{
get<1>(score_board[name])++;
}
if (check==true&&hasdone[part]==false&&ishedone[name][part]==false)
{
hasdone[part]=true;
ishedone[name][part]=true;
get<0>(score_board[name]) += min;
get<2>(score_board[name])++;
}
if (check==true&&hasdone[part]==true&&ishedone[name][part]==false)
{
ishedone[name][part]=true;
get<0>(score_board[name]) += min;
get<2>(score_board[name])++;
}
}
vector<tuple<int,int,string>> order;
for (auto o : score_board)
{
int summit = (get<1>(o.second)*20) + get<0>(o.second);
order.push_back({-(get<2>(o.second)),summit,o.first});
}
sort(order.begin(),order.end());
int NUM =0;
auto third = order.begin();
if (order.size()>3)
{
third = order.begin()+2;
}
for (auto o = order.begin() , end=order.end() ; o!=end ; o++)
{
if (NUM<3||((get<0>(*o)==get<0>(*third))&&get<1>(*o)==get<1>(*third)))
{
cout << get<2>(*o);
cout << " " << -(get<0>(*o));
cout << " " << get<1>(*o) << endl;
}
NUM++;
}
} | # 2070504, 2024-11-02 12:10:48, PPPPPPPPPP-PPPPPPPPP- (90%)
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <set>
#include <algorithm>
using namespace std;
int main () {
int submission; cin >> submission;
vector<tuple<int,string,int,bool>> grader;
map<string,tuple<int,map<int,int>,int>> score_board; // team , score , penaltycount, done
map<int,bool> hasdone;
map<string,map<int,bool>> ishedone;
set<int> partc;
for (int i = 0; i < submission; i++)
{
int min, part; string team; char pass;
cin >> min >> team >> part >> pass;
bool check=false;
if (pass == 'T')check = true;
grader.push_back({min,team,part,check});
if (score_board.find(team)!=score_board.end())
{ (get<1>(score_board[team]))[part]=0;
}else{ score_board[team]={0,{{part,0}},0};}
if (hasdone.find(part)==hasdone.end())
{
hasdone[part]=false;
}
if (ishedone.find(team)==ishedone.end())
{
ishedone[team]={{part,false}};
}else{
ishedone[team].insert({part,false});
}
}
for (auto time : grader)
{
string name = get<1>(time);
int min = get<0>(time), part = get<2>(time);
bool check = get<3>(time);
if (check==false&&hasdone[part]==false)
{
get<1>(score_board[name])[part]++;
}
if (check==true&&hasdone[part]==false&&ishedone[name][part]==false)
{
hasdone[part]=true;
ishedone[name][part]=true;
get<0>(score_board[name]) += min;
get<2>(score_board[name])++;
}
if (check==true&&hasdone[part]==true&&ishedone[name][part]==false)
{
ishedone[name][part]=true;
get<0>(score_board[name]) += min;
get<2>(score_board[name])++;
}
}
vector<tuple<int,int,string>> order;
for (auto o : score_board)
{
string name =o.first;
int penaltyplus =0;
for (auto r : get<1>(o.second))
{
if (ishedone[name][r.first])
{
penaltyplus += (r.second*20);
}
}
int summit = penaltyplus + get<0>(o.second);
order.push_back({-(get<2>(o.second)),summit,o.first});
}
sort(order.begin(),order.end());
int NUM =0;
auto third = order.begin();
if (order.size()>3)
{
third = order.begin()+2;
}
for (auto o = order.begin() , end=order.end() ; o!=end ; o++)
{
if (NUM<3||((get<0>(*o)==get<0>(*third))&&get<1>(*o)==get<1>(*third)))
{
cout << get<2>(*o);
cout << " " << -(get<0>(*o));
cout << " " << get<1>(*o) << endl;
}
NUM++;
}
} |
# 2070209, 2024-11-02 11:58:07, PPPPPPPPPP-PP-P----P- (66%)
#include<iostream>
#include<vector>
#include<utility>
#include<unordered_map>
#include<map>
#include<algorithm>
using namespace std;
void ook(vector<pair<pair<int,int>,string>> &d){
for(int i=0;i<d.size();i++){
for(int j=i+1;j<d.size();j++){
if(d[i].first.first < d[j].first.first) swap(d[i],d[j]);
else if(d[i].first.first == d[j].first.first && d[i].first.second > d[j].first.second) swap(d[i],d[j]);
}
}
}
int main(){
int n,time,no;
string team,result;
cin>>n;
unordered_map<string,pair<int,int>> out; //team: score,penalty
unordered_map<string,unordered_map<int,vector<string>>> data;
while (n--){
cin>>time>>team>>no>>result;
if(out.find(team) == out.end()) out[team]=make_pair(0,0);
if(data.find(team) == data.end()) data[team]={};
if(result =="T"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
out[team].first+=1;
out[team].second+=time+(20*data[team][no].size());
data[team][no].push_back("T");
}
}else if( result == "F"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
data[team][no].push_back("F");
}
}
}
vector<pair<pair<int,int>,string>> sub;
for(auto i:out){
sub.push_back(make_pair(make_pair(i.second.first,i.second.second),i.first));
}
ook(sub);
int o=3;
if(o>sub.size()) o=sub.size();
for(int i=0;i<o;i++){
cout<<sub[i].second<<" "<<sub[i].first.first<<" "<<sub[i].first.second<<endl;
}
} | # 2070291, 2024-11-02 12:02:00, PPPPPPPPPP-PPPPP---PP (80%)
#include<iostream>
#include<vector>
#include<utility>
#include<unordered_map>
#include<map>
#include<algorithm>
using namespace std;
void ook(vector<pair<pair<int,int>,string>> &d){
for(int i=0;i<d.size();i++){
for(int j=i+1;j<d.size();j++){
if(d[i].first.first < d[j].first.first) swap(d[i],d[j]);
else if(d[i].first.first == d[j].first.first && d[i].first.second > d[j].first.second) swap(d[i],d[j]);
}
}
}
int main(){
int n,time,no;
string team,result;
cin>>n;
unordered_map<string,pair<int,int>> out; //team: score,penalty
unordered_map<string,unordered_map<int,vector<string>>> data;
while (n--){
cin>>time>>team>>no>>result;
if(out.find(team) == out.end()) out[team]=make_pair(0,0);
if(data.find(team) == data.end()) data[team]={};
if(result =="T"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
out[team].first+=1;
out[team].second+=time+(20*data[team][no].size());
data[team][no].push_back("T");
}
}else if( result == "F"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
data[team][no].push_back("F");
}
}
}
vector<pair<pair<int,int>,string>> sub;
for(auto i:out){
sub.push_back(make_pair(make_pair(i.second.first,i.second.second),i.first));
}
ook(sub);
int o=3;
if(o>sub.size()) o=sub.size();
for(int i=0;i<o;i++){
cout<<sub[i].second<<" "<<sub[i].first.first<<" "<<sub[i].first.second<<endl;
if(i==2 && sub[i].first.first==sub[i+1].first.first && sub[i].first.second == sub[i+1].first.second){
cout<<sub[i+1].second<<" "<<sub[i+1].first.first<<" "<<sub[i+1].first.second<<endl;
}
}
} | # 2070356, 2024-11-02 12:05:16, PPPPPPPPPPPPPPPP---PP (85%)
#include<iostream>
#include<vector>
#include<utility>
#include<unordered_map>
#include<map>
#include<algorithm>
using namespace std;
void ook(vector<pair<pair<int,int>,string>> &d){
for(int i=0;i<d.size();i++){
for(int j=i+1;j<d.size();j++){
if(d[i].first.first < d[j].first.first) swap(d[i],d[j]);
else if(d[i].first.first == d[j].first.first && d[i].first.second > d[j].first.second) swap(d[i],d[j]);
}
}
}
int main(){
int n,time,no;
string team,result;
cin>>n;
unordered_map<string,pair<int,int>> out; //team: score,penalty
unordered_map<string,unordered_map<int,vector<string>>> data;
while (n--){
cin>>time>>team>>no>>result;
if(out.find(team) == out.end()) out[team]=make_pair(0,0);
if(data.find(team) == data.end()) data[team]={};
if(result =="T"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
out[team].first+=1;
out[team].second+=time+(20*data[team][no].size());
data[team][no].push_back("T");
}
}else if( result == "F"){
if(find(data[team][no].begin(),data[team][no].end(),"T") == data[team][no].end()){
data[team][no].push_back("F");
}
}
}
vector<pair<pair<int,int>,string>> sub;
for(auto i:out){
sub.push_back(make_pair(make_pair(i.second.first,i.second.second),i.first));
}
ook(sub);
int o=3;
if(o>sub.size()) o=sub.size();
for(int i=0;i<o;i++){
if(sub[i].first.first!=0 && sub[i].first.second !=0){
cout<<sub[i].second<<" "<<sub[i].first.first<<" "<<sub[i].first.second<<endl;
if(i==2 && sub[i].first.first==sub[i+1].first.first && sub[i].first.second == sub[i+1].first.second){
cout<<sub[i+1].second<<" "<<sub[i+1].first.first<<" "<<sub[i+1].first.second<<endl;
}}
}
} |
# 2071389, 2024-11-02 14:30:17, P---PPPPPP--PPPP----- (52%)
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <utility>
#include <tuple>
int main(){
int n ;
std::cin >> n;
std::map<std::string,std::pair<int,int>> penalty;
std::map<std::string,std::map<int,int>> passq;
while(n--){
int time ,que;
std::string team , pass;
std::cin >> time >>team >> que >>pass;
if(!passq[team][que] && pass == "T"){
penalty[team].second += time;
penalty[team].first++;
passq[team][que] = 1 ;
}else if(!passq[team][que] && pass == "F"){
penalty[team].second += time;
}
}
std::map<int,std::map<int,std::vector<std::string>>> out;
for(auto & i : penalty ){
out[-i.second.first][i.second.second].push_back(i.first);
}
// sort(out.begin() , out.end() , [](auto a , auto b){
// return a > b;
// });
int m = 0 ;
for(auto i : out){
for(auto j : i.second){
for(auto k : j.second){
std::cout << k <<" " << (-i.first) << " " << j.first <<std::endl;
m++;
}
if(m>=3)break;
}
if(m>=3)break;
}
} | # 2071430, 2024-11-02 14:34:12, PP-PPPPPPP-PPPPPPPPP- (85%)
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <utility>
#include <tuple>
int main(){
int n ;
std::cin >> n;
std::map<std::string,std::pair<int,int>> penalty;
std::map<std::string,std::map<int,int>> passq;
while(n--){
int time ,que;
std::string team , pass;
std::cin >> time >>team >> que >>pass;
if(!passq[team][que] && pass == "T"){
penalty[team].second += time;
penalty[team].first+=1;
passq[team][que] = 1 ;
}else if(!passq[team][que] && pass == "F"){
penalty[team].second += 20;
}
}
std::map<int,std::map<int,std::vector<std::string>>> out;
for(auto & i : penalty ){
out[-i.second.first][i.second.second].push_back(i.first);
}
// sort(out.begin() , out.end() , [](auto a , auto b){
// return a > b;
// });
int m = 0 ;
for(auto i : out){
for(auto j : i.second){
for(auto k : j.second){
std::cout << k <<" " << (-i.first) << " " << j.first <<std::endl;
m++;
}
if(m>=3)break;
}
if(m>=3)break;
}
} |
# 2071622, 2024-11-02 14:55:43, PP-PPPP-PP-PP-P------ (52%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
}
else{
mp[team] = {0,0,1};
}
}
else{
if(mp.count(team)){
auto& tp = mp[team];
get<1>(tp) += get<2>(tp) * 20 + time;
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
for(auto [a,b,c] : ans){
cout << c << ' ' << -a << ' ' << b << '\n';
count++;
if(count == 3){
break;
}
}
} | # 2071831, 2024-11-02 15:20:34, PP-PPPP-PP-PP-P------ (52%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
for(auto [a,b,c] : ans){
cout << c << ' ' << -a << ' ' << b << '\n';
count++;
if(count == 3){
break;
}
}
} | # 2071842, 2024-11-02 15:21:39, PP-PPPPPPP-PP-P------ (57%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(!se.count(num)){
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
for(auto [a,b,c] : ans){
cout << c << ' ' << -a << ' ' << b << '\n';
count++;
if(count == 3){
break;
}
}
} | # 2071859, 2024-11-02 15:23:25, PP-PPPPPPPPPP-P------ (61%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(!se.count(num)){
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
for(auto [a,b,c] : ans){
if(-a != 0 && b != 0){
cout << c << ' ' << -a << ' ' << b << '\n';
count++;
if(count == 3){
break;
}
}
}
} | # 2071921, 2024-11-02 15:27:44, PP-PPPPPPPPPPPPPP---P (80%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(!se.count(num)){
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
set<int> winnerScore;
set<string> winner;
for(auto [a,b,c] : ans){
if(winnerScore.size() > 2){
break;
}
winnerScore.insert(b);
}
for(auto [a,b,c] : ans){
if(-a != 0 && b != 0){
if(winnerScore.count(b)){
cout << c << ' ' << -a << ' ' << b << '\n';
}
}
}
} | # 2071956, 2024-11-02 15:29:50, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(!se.count(num)){
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
set<int> winnerScore;
set<string> winner;
for(auto [a,b,c] : ans){
if(winnerScore.size() > 1){
break;
}
winnerScore.insert(b);
}
for(auto a : winnerScore){
cout << a << ' ';
}
cout << '\n';
for(auto [a,b,c] : ans){
if(-a != 0 && b != 0){
if(winnerScore.count(b)){
cout << c << ' ' << -a << ' ' << b << '\n';
}
}
}
} | # 2071961, 2024-11-02 15:30:07, PP-PPPPP--PP--------- (42%)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
int n ;cin >> n; // pass penalty fail
map<string,tuple<int,int,int>> mp;
// num failtime
map<string,vector<pair<int,int>>> fail;
map<string,set<int>> passAlr;
int time,num; string team,cmd;
while(n--){
cin >> time >> team >> num >> cmd;
if(cmd == "F"){
if(mp.count(team)){
auto& tp = mp[team];
get<2>(tp)++;
// cout << "team " << team << " fail " << get<2>(tp) << '\n';
}
else{
mp[team] = {0,0,1};
}
if(fail.count(team)){
auto& vec = fail[team];
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
it->second++;
break;
}
}
}
else{
fail[team].push_back({num,1});
}
}
else if(cmd == "T"){
auto se = passAlr[team];
if(!se.count(num)){
if(mp.count(team) && !(se.count(num))){
auto& tp = mp[team];
auto& p = fail[team];
auto& vec = fail[team];
int plus = 0;
bool found = false;
for(auto it=vec.begin();it!=vec.end();it++){
if(it->first == num){
found = true;
plus = it->second;
vec.erase(it);
break;
}
}
if(found){
get<1>(tp) += 20*plus + time;
}
else{
get<1>(tp) += time;
}
get<2>(tp) = 0;
get<0>(tp)++;
}
else{
mp[team] = {1,time,0};
}
}
passAlr[team].insert(num);
}
}
vector<tuple<int,int,string>> ans;
for(auto [a,tp] : mp){
ans.push_back({-get<0>(tp),get<1>(tp),a});
}
int count = 0;
sort(ans.begin(),ans.end());
set<int> winnerScore;
set<string> winner;
for(auto [a,b,c] : ans){
if(winnerScore.size() > 1){
break;
}
winnerScore.insert(b);
}
cout << '\n';
for(auto [a,b,c] : ans){
if(-a != 0 && b != 0){
if(winnerScore.count(b)){
cout << c << ' ' << -a << ' ' << b << '\n';
}
}
}
} |
# 2071822, 2024-11-02 15:19:05, PP-PPPPPPPPP-PPPP---- (71%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if ((correct[c.second]==max)||(correct[c.second]==max&&time_previous==c.first)){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
time_previous =c.first;
}
}
if (time==0){
break;
}
max--;
}
return 0;
} | # 2071832, 2024-11-02 15:20:35, PP-PPPPPPPPP-PPPPPP-- (80%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if ((correct[c.second]==max)||(correct[c.second]==max&&time_previous==c.first)){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
time_previous =c.first;
}
}
if (time<=0){
break;
}
max--;
}
return 0;
} | # 2071882, 2024-11-02 15:24:51, PP-P-PPP-P-P-----PP-- (47%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous=99999999;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if (c.first<=time_previous&&((correct[c.second]==max)||(correct[c.second]==max&&time_previous==c.first))){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
time_previous =c.first;
}
}
if (time<=0){
break;
}
max--;
}
return 0;
} | # 2071912, 2024-11-02 15:27:17, PP--PP--P----P------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous=99999999999;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if (correct[c.second]==max||time_previous<=c.first){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
time_previous =c.first;
}
}
if (time<=0){
break;
}
max--;
}
return 0;
} | # 2071953, 2024-11-02 15:29:49, PP-PPPPPPPPP-PPPP---- (71%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous=9999999;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if (correct[c.second]==max){
if (time_previous==c.first){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
}
else{
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
}
time_previous =c.first;
}
}
if (time<=0){
break;
}
max--;
}
return 0;
} | # 2072006, 2024-11-02 15:32:00, PP-PPPPPPPPP-PPPPPP-- (80%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int t,num;
char check;
string team_name;
map<string,int> time_team;
map<string,int> correct;
map<string ,set<int>>done;
set<string>all_team;
while (n--){
cin>>t>>team_name>>num>>check;
if (time_team.find(team_name)==time_team.end()){
time_team[team_name] =0;
correct[team_name] =0;
all_team.insert(team_name);
}
if (check=='F'&&done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=20;
}
else{
if (done[team_name].find(num)==done[team_name].end()){
time_team[team_name]+=t;
correct[team_name]+=1;
done[team_name].insert(num);
}
}
}
set<pair<int,string>>time_sort;
set<int> number;
int time =3;
int max;
int time_previous;
for (auto &c :all_team){
time_sort.insert(make_pair(time_team[c],c));
number.insert(correct[c]);
}
for (auto&c:number){
max =c;
}
for (int i = max; i>0; i--){
for (auto &c :time_sort){
if ((correct[c.second]==max)||(correct[c.second]==max&&time_previous==c.first)){
cout<<c.second<<" "<<max<<" "<<c.first<<endl;
time--;
time_previous =c.first;
}
}
if (time<=0){
break;
}
max--;
}
return 0;
} |
# 2071596, 2024-11-02 14:53:06, PPPPPPPPPPPP-PPP----- (71%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
Maxscore+=1;
}
int count = 0;
while (Maxscore--)
{
if (count == 3){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
count++;
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check;
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
for (auto output : Check){
string Team = output.second;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
}
}
} | # 2071746, 2024-11-02 15:10:56, PPPPPPPP-PP------PPPP (66%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
}
Maxscore+=1;
int count = 0;
while (Maxscore--)
{
//cout << Maxscore << " Count = " << count << endl;
if (count >= 2){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check; //Penalty,Team
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
int oldpenal =0;
int curpenal =0;
for (auto output : Check){
if (oldpenal==0){
oldpenal = output.first;
}
else{
curpenal = output.first;
if (oldpenal == curpenal){
//do nothing
}
else{
oldpenal = curpenal;
//cout << Maxscore << " Count = " << count << endl;
if (count >= 2) {
break;
}
}
}
count++;
string Team = output.second;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
}
}
} | # 2071756, 2024-11-02 15:12:48, PPPPPPPPPPPPPP-P-PP-- (80%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
}
Maxscore+=1;
int count = 0;
while (Maxscore--)
{
//cout << Maxscore << " Count = " << count << endl;
if (count >= 3){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check; //Penalty,Team
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
int oldpenal =0;
int curpenal =0;
for (auto output : Check){
if (oldpenal==0){
oldpenal = output.first;
}
else{
curpenal = output.first;
if (oldpenal == curpenal){
//do nothing
}
else{
oldpenal = curpenal;
//cout << Maxscore << " Count = " << count << endl;
if (count >= 3) {
break;
}
}
}
count++;
string Team = output.second;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
}
}
} | # 2071856, 2024-11-02 15:23:22, PPPP--PP-P----------- (33%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
}
Maxscore+=1;
int count = 0;
while (Maxscore--)
{
//cout << Maxscore << " Count = " << count << endl;
if (count >= 3){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check; //Penalty,Team
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
int oldpenal =0;
int curpenal =0;
set<string> OutputNames;
for (auto output : Check){
if (oldpenal==0){
//cout << "First" << output.second <<endl;
OutputNames.insert(output.second);
oldpenal = output.first;
}
else{
curpenal = output.first;
if (oldpenal == curpenal){
//cout << "Same Penal"<< output.second << endl;
OutputNames.insert(output.second);
//do nothing
}
else{ //new penalty
cout << OutputNames.size();
//cout << "New Penal" << output.second << endl;
for (auto out : OutputNames){
count++;
string Team = out;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
OutputNames = {};
OutputNames.insert(output.second);
oldpenal = curpenal;
if (count >= 3) {
break;
}
}
}
}
}
}
} | # 2071919, 2024-11-02 15:27:31, PPPP--PP-P--P-------P (42%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
}
Maxscore+=1;
int count = 0;
while (Maxscore--)
{
//cout << Maxscore << " Count = " << count << endl;
if (count >= 3){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check; //Penalty,Team
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
int oldpenal =0;
int curpenal =0;
set<string> OutputNames;
int amount = 0;
for (auto output : Check){
if (oldpenal==0){
//cout << "First" << output.second <<endl;
OutputNames.insert(output.second);
oldpenal = output.first;
}
else{
curpenal = output.first;
if (oldpenal == curpenal){
//cout << "Same Penal"<< output.second << endl;
OutputNames.insert(output.second);
}
else if ((oldpenal!= curpenal)||(amount == Check.size()-1))//new penalty or last
{
//cout << "New Penal" << output.second << endl;
for (auto out : OutputNames){
count++;
string Team = out;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
OutputNames = {};
OutputNames.insert(output.second);
oldpenal = curpenal;
if (count >= 3) {
break;
}
}
}
amount++;
}
}
}
} | # 2071993, 2024-11-02 15:31:34, PPPPPPPPPPPPPP-P-PP-- (80%)
#include <bits/stdc++.h>
using namespace std;
map<string,int> Chart;
map<string,int> Penalty;
map<string,set<pair<int,int>>> PenaltyWrong;
map<string,set<int>> QDone;
int main(){
int num;
cin >> num;
while(num--){
int Time,Question;
string Team,Mark;
cin >> Time >> Team >> Question >> Mark;
if (Mark == "T"){
if (QDone[Team].insert(Question).second) //add to done
{
//check if there is a wrong penalty for this Q
for (auto c : PenaltyWrong){
if (c.first == Team){ //this team
for (auto cc : c.second){ //all wrong penalties of this team
if (cc.first == Question){
//cout << "Wrong Answer on " << Question << " Penalty 20" << endl;
Penalty[Team] += 20;
}
}
}
}
Penalty[Team] += Time;
Chart[Team]+=1;
}
}
else{ //wrong answer
if (QDone[Team].count(Question) > 0) //already solved
{
}
else{
PenaltyWrong[Team].insert(make_pair(Question,Time));
}
}
}
int Maxscore =0;
for (auto c : Chart){
Maxscore = max(Maxscore,c.second);
//cout << c.first << " " << c.second <<" max= "<< Maxscore <<endl; //team, score, maxscore total
}
Maxscore+=1;
int count = 0;
while (Maxscore--)
{
//cout << Maxscore << " Count = " << count << endl;
if (count >= 3){
break;
}
//cout << Maxscore << endl;
vector<string> Scorelees;
for (auto c : Chart){
if (c.second == Maxscore){
Scorelees.emplace_back(c.first);
}
}
if (Scorelees.size() == 1){ //only 1 person has that score
string Team = Scorelees[0];
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
else
{
set<pair<int,string>> Check; //Penalty,Team
for (auto team : Scorelees){
Check.emplace(Penalty[team],team);
}
int oldpenal =0;
int curpenal =0;
set<string> OutputNames;
int amount = 0;
//cout << Check.size();
for (auto output : Check){
if (oldpenal==0){
//cout << "First" << output.second <<endl;
OutputNames.insert(output.second);
oldpenal = output.first;
}
else{
curpenal = output.first;
if (oldpenal == curpenal){
//cout << "Same Penal"<< output.second << endl;
OutputNames.insert(output.second);
}
else if (oldpenal!= curpenal)//new penalty or last
{
//cout << "New Penal" << output.second << endl;
for (auto out : OutputNames){
count++;
string Team = out;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
OutputNames = {};
OutputNames.insert(output.second);
oldpenal = curpenal;
if (count >= 3) {
break;
}
}
if (amount == Check.size()-1){
for (auto out : OutputNames){
count++;
string Team = out;
cout << Team << " " << Chart[Team] << " " << Penalty[Team] << endl;
}
}
}
amount++;
}
}
}
} |
# 2071851, 2024-11-02 15:22:47, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map<string,int> pen,cnt;
map<pair<string,int>,bool> now={};
map<pair<string,int>,int> countf;
multiset<int> s;
vector<pair<pair<int,int>,string>> v;
int q,time,num,mx = 0;
string name,tf;
cin >> q;
while(q--){
cin >> time >> name >> num >> tf;
if(!pen[name])pen[name] = 0;
if(!countf[{name,num}])countf[{name,num}] = 0;
if(now[{name,num}] == true)continue;
if(tf == "T"){
pen[name] += time + 20*countf[{name,num}];
now[{name,num}] = true;
cnt[name]++;
}
if(tf == "F"){
countf[{name,num}]++;
}
}
for(auto x:cnt){
s.insert(x.second);
mx = max(mx,x.second);
if(x.second > 0){
v.push_back({{-1*x.second,pen[x.first]},x.first});
}
}
sort(v.begin(),v.end());
int i = 0,temp1=0,temp2=0;
for(auto x:v){
if(i == 3)break;
if(temp1 == -1*x.first.first && temp2 == x.first.second)i--;
cout << -1*x.first.first << " " << x.first.second << ' ' << x.second << endl;
temp1 = -1*x.first.first;
temp2 = x.first.second;
i++;
}
} | # 2071866, 2024-11-02 15:23:46, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map<string,int> pen,cnt;
map<pair<string,int>,bool> now={};
map<pair<string,int>,int> countf;
multiset<int> s;
vector<pair<pair<int,int>,string>> v;
int q,time,num,mx = 0;
string name,tf;
cin >> q;
while(q--){
cin >> time >> name >> num >> tf;
if(!pen[name])pen[name] = 0;
if(!countf[{name,num}])countf[{name,num}] = 0;
if(now[{name,num}] == true)continue;
if(tf == "T"){
pen[name] += time + 20*countf[{name,num}];
now[{name,num}] = true;
cnt[name]++;
}
if(tf == "F"){
countf[{name,num}]++;
}
}
for(auto x:cnt){
s.insert(x.second);
mx = max(mx,x.second);
if(x.second > 0){
v.push_back({{-1*x.second,pen[x.first]},x.first});
}
}
sort(v.begin(),v.end());
int i = 0,temp1=0,temp2=0;
for(auto x:v){
if(i == 3)break;
if(temp1 == -1*x.first.first && temp2 == x.first.second)i--;
cout << x.second << " " << x.first.second << ' ' << -1*x.first.first << endl;
temp1 = -1*x.first.first;
temp2 = x.first.second;
i++;
}
} | # 2071869, 2024-11-02 15:24:12, PPPPPPPPPPPPP-P----P- (71%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map<string,int> pen,cnt;
map<pair<string,int>,bool> now={};
map<pair<string,int>,int> countf;
multiset<int> s;
vector<pair<pair<int,int>,string>> v;
int q,time,num,mx = 0;
string name,tf;
cin >> q;
while(q--){
cin >> time >> name >> num >> tf;
if(!pen[name])pen[name] = 0;
if(!countf[{name,num}])countf[{name,num}] = 0;
if(now[{name,num}] == true)continue;
if(tf == "T"){
pen[name] += time + 20*countf[{name,num}];
now[{name,num}] = true;
cnt[name]++;
}
if(tf == "F"){
countf[{name,num}]++;
}
}
for(auto x:cnt){
s.insert(x.second);
mx = max(mx,x.second);
if(x.second > 0){
v.push_back({{-1*x.second,pen[x.first]},x.first});
}
}
sort(v.begin(),v.end());
int i = 0,temp1=0,temp2=0;
for(auto x:v){
if(i == 3)break;
if(temp1 == -1*x.first.first && temp2 == x.first.second)i--;
cout << x.second << " " << -1*x.first.first << ' ' << x.first.second << endl;
temp1 = -1*x.first.first;
temp2 = x.first.second;
i++;
}
} | # 2071955, 2024-11-02 15:29:49, PPPPPPPPPPPPP-P--PPP- (80%)
#include <bits/stdc++.h>
using namespace std;
int main(){
map<string,int> pen,cnt;
map<pair<string,int>,bool> now={};
map<pair<string,int>,int> countf;
multiset<int> s;
vector<pair<pair<int,int>,string>> v;
int q,time,num,mx = 0;
string name,tf;
cin >> q;
while(q--){
cin >> time >> name >> num >> tf;
if(!pen[name])pen[name] = 0;
if(!countf[{name,num}])countf[{name,num}] = 0;
if(now[{name,num}] == true)continue;
if(tf == "T"){
pen[name] += time + 20*countf[{name,num}];
now[{name,num}] = true;
cnt[name]++;
}
if(tf == "F"){
countf[{name,num}]++;
}
}
for(auto x:cnt){
s.insert(x.second);
mx = max(mx,x.second);
if(x.second > 0){
v.push_back({{-1*x.second,pen[x.first]},x.first});
}
}
sort(v.begin(),v.end());
int i = 0,temp1=0,temp2=0,ct = 0;
for(auto x:v){
if(i == 3)break;
if((temp1 != -1*x.first.first || temp2 != x.first.second) && ct > 3)break;
if(temp1 == -1*x.first.first && temp2 == x.first.second)i--;
cout << x.second << " " << -1*x.first.first << ' ' << x.first.second << endl;
temp1 = -1*x.first.first;
temp2 = x.first.second;
i++;
ct++;
}
} |
# 2071322, 2024-11-02 14:23:02, PP-PPPPPPPPPPPPPP--P- (80%)
#include <iostream>
#include <tuple>
#include <map>
#include <set>
std::string teamName, problem, result;
int submitTime;
std::map<std::string, int> penaltyOfTeam;
std::map<std::string, int> scoreOfTeam;
std::map<std::string, std::map<std::string, bool>> probStatus;
int totalSubmission;
std::set<std::tuple<int, int, std::string>> toPrint; // score penalty teamName
int main()
{
std::cin >> totalSubmission;
for (int i = 0; i < totalSubmission; i++)
{
std::cin >> submitTime >> teamName >> problem >> result;
if (probStatus[teamName][problem]) // if already passed
continue;
else if (result == "T") // did not pass, now do
{
probStatus[teamName][problem] = true;
penaltyOfTeam[teamName] += submitTime;
scoreOfTeam[teamName]++;
}
else if (result == "F") // did not pass, and still doesn't
{
penaltyOfTeam[teamName] += 20;
}
}
// iterating over the teams that have atleast 1 score
for (auto team = scoreOfTeam.begin(); team != scoreOfTeam.end(); team++)
{
toPrint.insert(std::make_tuple(-scoreOfTeam[team->first], penaltyOfTeam[team->first], team->first));
}
// printing
int previousScore = 0, previousPenalty= 0, counter = 3, printed = 0;
for (auto x : toPrint)
{
if (previousScore != -std::get<0>(x) || previousPenalty != std::get<1>(x)) counter--;
else printed--;
if (counter < 0) break;
if (printed > 2) break;
std::cout << std::get<2>(x) << " " << -std::get<0>(x) << " " << std::get<1>(x) << "\n";
previousScore = -std::get<0>(x);
previousPenalty = std::get<1>(x);
printed++;
}
} |
# 2070226, 2024-11-02 11:58:55, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
// num penal
map<string, pair<int, int>> p;
// choice check
map<string, map<int, bool>> pc;
map<string, map<int, int>> pcpenal;
string name, check;
int c, time;
int n;
cin >> n;
while(n--){
cin >> time >> name >> c >> check;
if (p.find(name) == p.end()) {
p[name].first = 0;
p[name].second = 0;
// cout << endl << "create new p with 0 done 0 penal " << name << endl;
}
if(pc[name].find(c) == pc[name].end()){
pc[name][c] = false;
// cout << "create new c : " << c << " for " << name << endl;
}
if(pcpenal[name].find(c) == pcpenal[name].end()){
pcpenal[name][c] = 0;
}
if(check=="T"){
if(pc[name][c] == false){
p[name].first += 1;
pc[name][c] = true;
p[name].second += time;
p[name].second += pcpenal[name][c];
// cout << "penal of " << name << " " << p[name].second << endl;
// cout << name << " (correct ) penal += " << time+pcpenal[name][c] << " choice " << c << " check" << endl;
}
}
else if(check=="F"){
if(pc[name][c] == false){
pcpenal[name][c] += 20;
// cout << name << " (wrong ) pcpenal += 20 " << endl;
}
}
}
map<int, vector<pair<string, int>>> ans;
// check
for(auto i=p.begin();i!=p.end();i++){
// cout << (*i).first << " " << (*i).second.first << " " << (*i).second.second << endl;
if(ans.find((*i).second.first) == ans.end()){
ans[(*i).second.first] = {};
}
ans[(*i).second.first].push_back(make_pair((*i).first, (*i).second.second));
// cout << "push ans " << endl;
sort(ans[(*i).second.first].begin(), ans[(*i).second.first].end());
}
// print ans
// cout << "PRINT ANS" << endl;
for(auto it = ans.begin() ; it != ans.end() ; it++){
for(int i=0 ; i<(*it).second.size() ; i++){
cout << (*it).second[i].first << " " << (*it).first << " " << (*it).second[i].second << endl;
}
}
} | # 2070470, 2024-11-02 12:09:39, PPPPPPPPP--P-PPPPPP-- (76%)
#include<bits/stdc++.h>
using namespace std;
int main(){
// num penal
map<string, pair<int, int>> p;
// choice check
map<string, map<int, bool>> pc;
map<string, map<int, int>> pcpenal;
string name, check;
int c, time;
int n;
cin >> n;
while(n--){
cin >> time >> name >> c >> check;
if (p.find(name) == p.end()) {
p[name].first = 0;
p[name].second = 0;
// cout << endl << "create new p with 0 done 0 penal " << name << endl;
}
if(pc[name].find(c) == pc[name].end()){
pc[name][c] = false;
// cout << "create new c : " << c << " for " << name << endl;
}
if(pcpenal[name].find(c) == pcpenal[name].end()){
pcpenal[name][c] = 0;
}
if(check=="T"){
if(pc[name][c] == false){
p[name].first += 1;
pc[name][c] = true;
p[name].second += time;
p[name].second += pcpenal[name][c];
// cout << "penal of " << name << " " << p[name].second << endl;
// cout << name << " (correct ) penal += " << time+pcpenal[name][c] << " choice " << c << " check" << endl;
}
}
else if(check=="F"){
if(pc[name][c] == false){
pcpenal[name][c] += 20;
// cout << name << " (wrong ) pcpenal += 20 " << endl;
}
}
}
map<int, vector<pair<int, string>>> ans;
// check
for(auto i=p.begin();i!=p.end();i++){
// cout << (*i).first << " " << (*i).second.first << " " << (*i).second.second << endl;
if(ans.find((*i).second.first) == ans.end()){
ans[(*i).second.first] = {};
}
ans[(*i).second.first].push_back(make_pair((*i).second.second, (*i).first));
// cout << "push ans " << endl;
sort(ans[(*i).second.first].begin(), ans[(*i).second.first].end());
}
// print ans
// cout << "PRINT ANS" << endl;
int count = 1;
for(auto it = ans.rbegin() ; it != ans.rend() ; it++){
// bool skip = false;
if(count == 3) break;
for(int i=0 ; i<(*it).second.size() ; i++){
cout << (*it).second[i].second << " " << (*it).first << " " << (*it).second[i].first << endl;
}
count++;
}
} |
# 2069810, 2024-11-02 11:27:03, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
ti[a]+=t;
if(boo=='T'){
p[a]++;
m[a].second = ti[a];}
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0)
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
} | # 2069815, 2024-11-02 11:27:29, P---PPP-PPP-P-P------ (42%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
ti[a]+=t;
if(boo=='T'){
p[a]++;
m[a].second = ti[a];}
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0)
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
}
} | # 2069919, 2024-11-02 11:36:49, P---PPP---P--P-P----- (33%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
ti[a]+=t;
if(boo=='T'){
if(ch[a]=='F')ti[a]+=20;
p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
}
}
}
} | # 2069941, 2024-11-02 11:38:17, P---PPP-PPP-PPPP----- (52%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
ti[a]+=t;
if(boo=='T'){
if(ch[a]=='F')ti[a]+=20;
p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} | # 2069985, 2024-11-02 11:42:46, PP-PPPP-PPPPPPPP----- (66%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
if(boo=='T'){
ti[a]+=t;
if(ch[a]=='F')ti[a]+=20;
p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} | # 2070180, 2024-11-02 11:55:49, PP-PPPPPPPPPPPPP----- (71%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
map<string, vector<int> > pch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
if(boo=='T'){
if(find(pch[a].begin(),pch[a].end(),num)==pch[a].end()){
ti[a]+=t;
p[a]++;
if(ch[a]=='F')ti[a]+=20;
pch[a].push_back(num);
}
//p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} | # 2070472, 2024-11-02 12:09:41, P---PPPPPPP-PPPP----- (57%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti,co;
map<string,char> ch;
map<string, vector<int> > pch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
if(boo=='T'){
if(find(pch[a].begin(),pch[a].end(),num)==pch[a].end()){
ti[a]+=t;
p[a]++;
if(ch[a]=='F')ti[a]+=40;
pch[a].push_back(num);
}
//p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} | # 2070498, 2024-11-02 12:10:43, PP-PPPPPPPPPPPPP----- (71%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
map<string, vector<int> > pch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
if(boo=='T'){
if(find(pch[a].begin(),pch[a].end(),num)==pch[a].end()){
ti[a]+=t;
p[a]++;
if(ch[a]=='F')ti[a]+=20;
pch[a].push_back(num);
}
//p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} | # 2070516, 2024-11-02 12:11:08, P---PPPPPPP-PPPP----- (57%)
#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<string,pair<int,int> >&a,pair<string,pair<int,int> >&b){
if(a.second.first==b.second.first)return a.second.second<b.second.second;
return a.second.first>b.second.first;
}
int main(){
int n;
cin>>n;
map<string,pair<int,int> > m;
map<string, int> p;
map<string,int > ti;
map<string,char> ch;
map<string, vector<int> > pch;
for(int i=0;i<n;i++){
int t; cin>>t;
string a;
int num;
char boo;
cin>>a>>num>>boo;
if(boo=='T'){
if(find(pch[a].begin(),pch[a].end(),num)==pch[a].end()){
ti[a]+=t;
p[a]++;
if(ch[a]=='F')ti[a]+=40;
pch[a].push_back(num);
}
//p[a]++;
m[a].second = ti[a];}
ch[a]=boo;
}
vector<pair<string,pair<int,int > > >temp;
for(auto i:p){
m[i.first].first = i.second;
}
for(auto i:m){
temp.push_back(i);
}
sort(temp.begin(),temp.end(),cmp);
for(int i=0;i<3;i++){
if(temp[i].second.first!=0){
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;
if(i==2){
if(temp[3].second.first==temp[i].second.first&&temp[3].second.second==temp[i].second.second)
{i++;
cout<<temp[i].first<<" "<<temp[i].second.first<<" "<<temp[i].second.second<<endl;}
}
}
}
} |
# 2071347, 2024-11-02 14:25:12, PPPP-P---P----------- (28%)
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
int main(){
int g;
std::cin>>g;
int time[g];
std::string name[g];
int qua[g];
bool tr[g];
std::map<std::string,std::pair<int,int>> tpt;
//std::map<std::string,int> tpq;
for (int i = 0; i <g; i++)
{
char h;
std::cin>>time[i]>>name[i]>>qua[i]>>h;
tr[i]=(h=='T');
if(tr[i])
{
int timein = time[i];
if(tpt[name[i]].first>0)tpt[name[i]].first+=1;
else tpt[name[i]].first=1;
for (int j = i-1; j >= 0; j--)
{
if(name[j]==name[i]&&!tr[j]&&qua[i]==qua[j]) timein+=20;
else if(name[j]==name[i]&&tr[j]&&qua[i]==qua[j]){
timein=0;
tpt[name[i]].first-=1;
break;
}
}
if(tpt[name[i]].second>0)tpt[name[i]].second+=timein;
else tpt[name[i]].second=timein;
}
}
for (auto i : tpt)
{
std::cout<<i.first<<" "<<i.second.first<<" "<<i.second.second<<"\n";
}
} | # 2071708, 2024-11-02 15:07:17, xxxxxxxxxxxxPTPTTTTP- (14%)
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<utility>
int main(){
int g;
std::cin>>g;
int time[g];
std::string name[g];
int qua[g];
bool tr[g];
std::map<std::string,std::pair<int,int>> tpt;
//std::map<std::string,int> tpq;
for (int i = 0; i <g; i++)
{
char h;
std::cin>>time[i]>>name[i]>>qua[i]>>h;
tr[i]=(h=='T');
if(tr[i])
{
int timein = time[i];
if(tpt[name[i]].first>0)tpt[name[i]].first+=1;
else tpt[name[i]].first=1;
for (int j = i-1; j >= 0; j--)
{
if(name[j]==name[i]&&!tr[j]&&qua[i]==qua[j]) timein+=20;
else if(name[j]==name[i]&&tr[j]&&qua[i]==qua[j]){
timein=0;
tpt[name[i]].first-=1;
break;
}
}
if(tpt[name[i]].second>0)tpt[name[i]].second+=timein;
else tpt[name[i]].second=timein;
}
}
int si=0;
si=tpt.size();
std::string key[si];
int l=0;
for (auto i : tpt)
{
key[l]=i.first;
l++;
}
//std::cout<<si <<"\n";
for(int i=0;i<si;)
{
int mor=0;
for(int j=i+1;j<si;j++)
{
if(tpt[key[i]].first<tpt[key[j]].first)
{
mor++;
}
if(tpt[key[i]].first==tpt[key[j]].first)
{
if(tpt[key[i]].second>tpt[key[j]].second)
{
mor++;
}
}
}
std::string fi=key[i];
std::string se=key[i+mor];
key[i]=se;
key[i+mor]=fi;
if(mor==0)i++;
}
int k=0;
for (int i=0;i<si;i++)
{
if(k<3&&tpt[key[i]].first>0)
{
std::cout<<key[i]<<" "<<tpt[key[i]].first<<" "<<tpt[key[i]].second<<"\n";
}
else break;
if(tpt[key[i]].first!=tpt[key[i+1]].first||tpt[key[i]].second!=tpt[key[i+1]].second)k++;
}
} | # 2071768, 2024-11-02 15:13:45, PPPPPPPPPPPP-T-TTTT-- (57%)
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<utility>
int main(){
int g;
std::cin>>g;
int time[g];
std::string name[g];
int qua[g];
bool tr[g];
std::map<std::string,std::pair<int,int>> tpt;
//std::map<std::string,int> tpq;
for (int i = 0; i <g; i++)
{
char h;
std::cin>>time[i]>>name[i]>>qua[i]>>h;
tr[i]=(h=='T');
if(tr[i])
{
int timein = time[i];
if(tpt[name[i]].first>0)tpt[name[i]].first+=1;
else tpt[name[i]].first=1;
for (int j = i-1; j >= 0; j--)
{
if(name[j]==name[i]&&!tr[j]&&qua[i]==qua[j]) timein+=20;
else if(name[j]==name[i]&&tr[j]&&qua[i]==qua[j]){
timein=0;
tpt[name[i]].first-=1;
break;
}
}
if(tpt[name[i]].second>0)tpt[name[i]].second+=timein;
else tpt[name[i]].second=timein;
}
}
/*for (auto i : tpt)
{
std::cout<<i.first<<"--"<<i.second.first<<"--"<<i.second.second<<"\n";
}*/
int si=0;
si=tpt.size();
std::string key[si];
int l=0;
for (auto i : tpt)
{
key[l]=i.first;
l++;
}
//std::cout<<si <<"\n";
for(int i=0;i<si;)
{
int mor=0;
for(int j=i+1;j<si;j++)
{
if(tpt[key[i]].first<tpt[key[j]].first)
{
mor++;
}
if(tpt[key[i]].first==tpt[key[j]].first)
{
if(tpt[key[i]].second>tpt[key[j]].second)
{
mor++;
}
}
}
std::string fi=key[i];
std::string se=key[i+mor];
key[i]=se;
key[i+mor]=fi;
if(mor==0)i++;
}
int k=0;
//std::cout<<"size:"<<si<<"\n";
int tem1 =0,tem2=0;
for (int i=0;i<si;i++)
{
if(k<3)
{
std::cout<<key[i]<<" "<<tpt[key[i]].first<<" "<<tpt[key[i]].second<<"\n";
}
else break;
if(i==0){
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
else
{
if (tem1!=tpt[key[i]].first||tem2!=tpt[key[i]].second)
{
k++;
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
}
}
} | # 2071795, 2024-11-02 15:16:41, PPPPPPPPPPPPPTPTTTTP- (71%)
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<utility>
int main(){
int g;
std::cin>>g;
int time[g];
std::string name[g];
int qua[g];
bool tr[g];
std::map<std::string,std::pair<int,int>> tpt;
//std::map<std::string,int> tpq;
for (int i = 0; i <g; i++)
{
char h;
std::cin>>time[i]>>name[i]>>qua[i]>>h;
tr[i]=(h=='T');
if(tr[i])
{
int timein = time[i];
if(tpt[name[i]].first>0)tpt[name[i]].first+=1;
else tpt[name[i]].first=1;
for (int j = i-1; j >= 0; j--)
{
if(name[j]==name[i]&&!tr[j]&&qua[i]==qua[j]) timein+=20;
else if(name[j]==name[i]&&tr[j]&&qua[i]==qua[j]){
timein=0;
tpt[name[i]].first-=1;
break;
}
}
if(tpt[name[i]].second>0)tpt[name[i]].second+=timein;
else tpt[name[i]].second=timein;
}
}
/*for (auto i : tpt)
{
std::cout<<i.first<<"--"<<i.second.first<<"--"<<i.second.second<<"\n";
}*/
int si=0;
si=tpt.size();
std::string key[si];
int l=0;
for (auto i : tpt)
{
key[l]=i.first;
l++;
}
//std::cout<<si <<"\n";
for(int i=0;i<si;)
{
int mor=0;
for(int j=i+1;j<si;j++)
{
if(tpt[key[i]].first<tpt[key[j]].first)
{
mor++;
}
if(tpt[key[i]].first==tpt[key[j]].first)
{
if(tpt[key[i]].second>tpt[key[j]].second)
{
mor++;
}
}
}
std::string fi=key[i];
std::string se=key[i+mor];
key[i]=se;
key[i+mor]=fi;
if(mor==0)i++;
}
int k=0;
//std::cout<<"size:"<<si<<"\n";
int tem1 =0,tem2=0;
for (int i=0;i<si;i++)
{
if(i==0){
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
else
{
if (tem1!=tpt[key[i]].first||tem2!=tpt[key[i]].second)
{
k++;
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
}
if(k<3)
{
std::cout<<key[i]<<" "<<tpt[key[i]].first<<" "<<tpt[key[i]].second<<"\n";
}
else break;
}
} | # 2071944, 2024-11-02 15:29:29, PPPPPPPPPPPPP-P----P- (71%)
#include<iostream>
#include<map>
#include<algorithm>
#include<string>
#include<utility>
int main(){
int g;
std::cin>>g;
int time[g];
std::string name[g];
int qua[g];
bool tr[g];
std::map<std::string,std::pair<int,int>> tpt;
//std::map<std::string,int> tpq;
for (int i = 0; i <g; i++)
{
char h;
std::cin>>time[i]>>name[i]>>qua[i]>>h;
tr[i]=(h=='T');
if(tr[i])
{
int timein = time[i];
if(tpt[name[i]].first>0)tpt[name[i]].first+=1;
else tpt[name[i]].first=1;
for (int j = i-1; j >= 0; j--)
{
if(name[j]==name[i]&&!tr[j]&&qua[i]==qua[j]) timein+=20;
else if(name[j]==name[i]&&tr[j]&&qua[i]==qua[j]){
timein=0;
tpt[name[i]].first-=1;
break;
}
}
if(tpt[name[i]].second>0)tpt[name[i]].second+=timein;
else tpt[name[i]].second=timein;
}
}
/*
for (auto i : tpt)
{
std::cout<<i.first<<"--"<<i.second.first<<"--"<<i.second.second<<"\n";
}
*/
int si=0;
si=tpt.size();
std::string key[si];
int l=0;
for (auto i : tpt)
{
key[l]=i.first;
l++;
}
//std::cout<<si <<"\n";
for(int i=0;i<si;)
{
int mor=0;
for(int j=i+1;j<si;j++)
{
if(tpt[key[i]].first<tpt[key[j]].first)
{
mor++;
//std::cout<<key[i]<<"--"<<key[j]<<"\n";
}
if(tpt[key[i]].first==tpt[key[j]].first)
{
if(tpt[key[i]].second>tpt[key[j]].second)
{
mor++;
//std::cout<<key[i]<<"--"<<key[j]<<"\n";
}
}
}
for(int j=i+mor;j<si;j++)
{
if(mor==0)
{
i++;
break;
}
if(tpt[key[i]].second!=tpt[key[j]].second||tpt[key[i]].first!=tpt[key[j]].first){
std::string fi=key[i];
std::string se=key[j];
key[i]=se;
key[j]=fi;
break;
}
}
}
int k=0;
//std::cout<<"size:"<<si<<"\n";
int tem1 =0,tem2=0;
for (int i=0;i<si;i++)
{
if(i==0){
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
else
{
if (tem1!=tpt[key[i]].first||tem2!=tpt[key[i]].second)
{
k++;
tem1=tpt[key[i]].first;
tem2=tpt[key[i]].second;
}
}
if(k<3)
{
std::cout<<key[i]<<" "<<tpt[key[i]].first<<" "<<tpt[key[i]].second<<"\n";
}
else break;
}
} |
# 2071632, 2024-11-02 14:56:56, P-P--P---P----------- (19%)
#include<iostream>
#include<map>
#include<utility>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
string name,TF;
int time,test;
map<string,pair<int,int>> out;
map<pair<string,int>,int> F_check;
map<pair<string,int>,bool> pass;
while(n--)
{
cin>>time>>name>>test>>TF;
pair<string,int> check(name,test);
if(pass.find(check)==pass.end())
{
if(TF=="T")
{
pass[check]=true;
}
else
{
pass[check]=false;
}
}
else
{
if(pass[check])
{
continue;
}
if(TF=="T")
{
pass[check]=true;
}
}
if(TF=="T")
{
if(out.find(name)!=out.end())
{
++out[name].first;
out[name].second+=time;
if(F_check.find(check)!=F_check.end())
{
out[name].second+=F_check[check]*20;
}
}
else
{
pair<int,int> in(1,time);
out[name]=in;
}
}
else
{
if(F_check.find(check)!=F_check.end())
{
++F_check[check];
}
else
{
F_check[check]=1;
}
}
}
for(auto itr : out)
{
pair<int,int> itr_out=itr.second;
cout<<itr.first<<" "<<itr_out.first<<" "<<itr_out.second<<endl;
}
return 0;
} | # 2071801, 2024-11-02 15:17:08, P-P--PPP-P----------- (28%)
#include<iostream>
#include<map>
#include<utility>
#include<string>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
string name,TF;
int time,test;
map<string,pair<int,int>> out;
map<pair<string,int>,int> F_check;
map<pair<string,int>,bool> pass;
while(n--)
{
cin>>time>>name>>test>>TF;
pair<string,int> check(name,test);
if(pass.find(check)==pass.end())
{
if(TF=="T")
{
pass[check]=true;
}
else
{
pass[check]=false;
}
}
else
{
if(pass[check])
{
continue;
}
if(TF=="T")
{
pass[check]=true;
}
}
if(TF=="T")
{
if(out.find(name)!=out.end())
{
++out[name].first;
out[name].second+=time;
if(F_check.find(check)!=F_check.end())
{
out[name].second+=F_check[check]*20;
}
}
else
{
pair<int,int> in(1,time);
out[name]=in;
}
}
else
{
if(F_check.find(check)!=F_check.end())
{
++F_check[check];
}
else
{
F_check[check]=1;
}
}
}
map<pair<int,int>,vector<string>> top3;
for(auto itr : out)
{
pair<int,int> itr_out=itr.second;
itr_out.first*=-1;
itr_out.second*=-1;
top3[itr_out].push_back(itr.first);
}
for(auto itr : top3)
{
pair<int,int> itr_out=itr.first;
vector<string> itr_string=itr.second;
for(auto itr2 : itr_string)
{
cout<<itr2<<" "<<itr_out.first*-1<<" "<<itr_out.second*-1<<endl;
}
}
return 0;
} | # 2071819, 2024-11-02 15:18:50, P-P--PPP-P----------- (28%)
#include<iostream>
#include<map>
#include<utility>
#include<string>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
string name,TF;
int time,test;
map<string,pair<int,int>> out;
map<pair<string,int>,int> F_check;
map<pair<string,int>,bool> pass;
while(n--)
{
cin>>time>>name>>test>>TF;
pair<string,int> check(name,test);
if(pass.find(check)==pass.end())
{
if(TF=="T")
{
pass[check]=true;
}
else
{
pass[check]=false;
}
}
else
{
if(pass[check])
{
continue;
}
if(TF=="T")
{
pass[check]=true;
}
}
if(TF=="T")
{
if(out.find(name)!=out.end())
{
++out[name].first;
out[name].second+=time;
if(F_check.find(check)!=F_check.end())
{
out[name].second+=F_check[check]*20;
}
}
else
{
pair<int,int> in(1,time);
out[name]=in;
}
}
else
{
if(F_check.find(check)!=F_check.end())
{
++F_check[check];
}
else
{
F_check[check]=1;
}
}
}
map<pair<int,int>,vector<string>> top3;
for(auto itr : out)
{
pair<int,int> itr_out=itr.second;
itr_out.first*=-1;
itr_out.second*=-1;
top3[itr_out].push_back(itr.first);
}
int run=0;
for(auto itr : top3)
{
if(run<3) ++run;
else break;
pair<int,int> itr_out=itr.first;
vector<string> itr_string=itr.second;
for(auto itr2 : itr_string)
{
cout<<itr2<<" "<<itr_out.first*-1<<" "<<itr_out.second*-1<<endl;
}
}
return 0;
} | # 2071841, 2024-11-02 15:21:38, P-P-PPPPPPP-PPPPP--P- (71%)
#include<iostream>
#include<map>
#include<utility>
#include<string>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
string name,TF;
int time,test;
map<string,pair<int,int>> out;
map<pair<string,int>,int> F_check;
map<pair<string,int>,bool> pass;
while(n--)
{
cin>>time>>name>>test>>TF;
pair<string,int> check(name,test);
if(pass.find(check)==pass.end())
{
if(TF=="T")
{
pass[check]=true;
}
else
{
pass[check]=false;
}
}
else
{
if(pass[check])
{
continue;
}
if(TF=="T")
{
pass[check]=true;
}
}
if(TF=="T")
{
if(out.find(name)!=out.end())
{
++out[name].first;
out[name].second+=time;
if(F_check.find(check)!=F_check.end())
{
out[name].second+=F_check[check]*20;
}
}
else
{
pair<int,int> in(1,time);
out[name]=in;
}
}
else
{
if(F_check.find(check)!=F_check.end())
{
++F_check[check];
}
else
{
F_check[check]=1;
}
}
}
map<pair<int,int>,vector<string>> top3;
for(auto itr : out)
{
pair<int,int> itr_out=itr.second;
itr_out.first*=-1;
top3[itr_out].push_back(itr.first);
}
int run=0;
for(auto itr : top3)
{
if(run<3) ++run;
else break;
pair<int,int> itr_out=itr.first;
vector<string> itr_string=itr.second;
for(auto itr2 : itr_string)
{
cout<<itr2<<" "<<itr_out.first*-1<<" "<<itr_out.second<<endl;
}
}
return 0;
} |
# 2068903, 2024-11-02 09:52:20, PPPPPPPPPP-PP-P----P- (66%)
#include "bits/stdc++.h"
using namespace std;
struct edge{
int get;
int pen;
set<int > memg;
map<int, int> fail;
};
struct final{
string name;
int fget;
int fpen;
bool operator < (const final& x) const{
if(fget == x.fget){
return fpen > x.fpen;
}
return fget < x.fget;
}
};
unordered_map <string , edge> ump;
priority_queue < final> pq;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
int t,p;
string name;
string sflag;
cin >> t >> name >> p >> sflag;
bool flag = (sflag == "T") ? true : false;
if(flag){
if(ump[name].memg.find(p) != ump[name].memg.end()){
continue;
}
ump[name].memg.insert(p);
ump[name].get++;
ump[name].pen+=t;
if(ump[name].fail.find(p) != ump[name].fail.end()){
ump[name].pen += ump[name].fail[p]*20;
}
}
if(!flag){
ump[name].fail[p]++;
}
}
for(auto x : ump){
final tmp;
tmp.name = x.first;
tmp.fget = x.second.get;
tmp.fpen = x.second.pen;
pq.push(tmp);
}
n = 0;
while (!pq.empty()){
if(n==3) return 0;
cout << pq.top().name << " " << pq.top().fget << " " << pq.top().fpen << "\n";
pq.pop();
n++;
}
return 0;
} | # 2068916, 2024-11-02 09:53:26, PPPPPPPPPPPPP-P----P- (71%)
#include "bits/stdc++.h"
using namespace std;
struct edge{
int get;
int pen;
set<int > memg;
map<int, int> fail;
};
struct final{
string name;
int fget;
int fpen;
bool operator < (const final& x) const{
if(fget == x.fget){
return fpen > x.fpen;
}
return fget < x.fget;
}
};
unordered_map <string , edge> ump;
priority_queue < final> pq;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
int t,p;
string name;
string sflag;
cin >> t >> name >> p >> sflag;
bool flag = (sflag == "T") ? true : false;
if(flag){
if(ump[name].memg.find(p) != ump[name].memg.end()){
continue;
}
ump[name].memg.insert(p);
ump[name].get++;
ump[name].pen+=t;
if(ump[name].fail.find(p) != ump[name].fail.end()){
ump[name].pen += ump[name].fail[p]*20;
}
}
if(!flag){
ump[name].fail[p]++;
}
}
for(auto x : ump){
final tmp;
tmp.name = x.first;
tmp.fget = x.second.get;
tmp.fpen = x.second.pen;
pq.push(tmp);
}
n = 0;
while (!pq.empty()){
if(n==3 || pq.top().fget == 0) return 0;
cout << pq.top().name << " " << pq.top().fget << " " << pq.top().fpen << "\n";
pq.pop();
n++;
}
return 0;
} |
# 2069878, 2024-11-02 11:31:52, PPPPPPPPPP-PP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
struct team
{
int num, time;
string name;
};
bool cmp(const team &a, const team &b)
{
if (a.num == b.num)
{
return a.time < b.time;
}
return a.num > b.num;
}
int main()
{
int n;
cin >> n;
unordered_map<string, int> time;
unordered_map<string, set<int>> success;
unordered_map<string, unordered_map<int, int>> penalty;
for (int i = 0; i < n; i++)
{
int minute, num;
string name;
char chk;
cin >> minute >> name >> num >> chk;
if (success[name].find(num) != success[name].end())
{
continue;
}
if (chk == 'T')
{
time[name] += minute;
time[name] += penalty[name][num];
success[name].insert(num);
}
else
{
penalty[name][num] += 20;
}
}
vector<team> vec;
for (auto &x : success) // x = {name, set<int>}
{
team temp = {x.second.size(), time[x.first], x.first};
vec.push_back(temp);
}
sort(vec.begin(), vec.end(), cmp);
int cnt = 0, prevNum = -1, prevTime = -1;
for (int i = 0; i < vec.size(); i++)
{
if (cnt >= 3)
{
break;
}
cout << vec[i].name << " " << vec[i].num << " " << vec[i].time << "\n";
if (prevNum == vec[i].num && prevTime == vec[i].time)
{
continue;
}
cnt++;
}
return 0;
} | # 2069893, 2024-11-02 11:34:07, PPPPPPPPPP-PP-P----P- (66%)
#include <bits/stdc++.h>
using namespace std;
struct team
{
int num, time;
string name;
};
bool cmp(const team &a, const team &b)
{
if (a.num == b.num)
{
return a.time < b.time;
}
return a.num > b.num;
}
int main()
{
int n;
cin >> n;
unordered_map<string, int> time;
unordered_map<string, set<int>> success;
unordered_map<string, unordered_map<int, int>> penalty;
for (int i = 0; i < n; i++)
{
int minute, num;
string name;
char chk;
cin >> minute >> name >> num >> chk;
if (success[name].find(num) != success[name].end())
{
continue;
}
if (chk == 'T')
{
time[name] += minute;
time[name] += penalty[name][num];
success[name].insert(num);
}
else
{
penalty[name][num] += 20;
}
}
vector<team> vec;
for (auto &x : success) // x = {name, set<int>}
{
team temp = {x.second.size(), time[x.first], x.first};
vec.push_back(temp);
}
sort(vec.begin(), vec.end(), cmp);
int cnt = 0, prevNum = -1, prevTime = -1;
for (int i = 0; i < vec.size(); i++)
{
if (cnt >= 3)
{
break;
}
cout << vec[i].name << " " << vec[i].num << " " << vec[i].time << "\n";
if (prevNum == vec[i].num && prevTime == vec[i].time)
{
continue;
}
prevNum = vec[i].num;
prevTime = vec[i].time;
cnt++;
}
return 0;
} | # 2070057, 2024-11-02 11:48:09, PPPPPPPPPP--P-P----P- (61%)
#include <bits/stdc++.h>
using namespace std;
struct team
{
int num, time, penalty;
string name;
};
bool cmp(const team &a, const team &b)
{
if (a.num == b.num)
{
if (a.time == b.time)
{
if (a.penalty == b.penalty)
{
return a.name < b.name;
}
return a.penalty < b.penalty;
}
return a.time < b.time;
}
return a.num > b.num;
}
int main()
{
int n;
cin >> n;
unordered_map<string, set<int>> success;
unordered_map<string, pair<int, int>> time; //{name, {minute, cntPenalty}}
unordered_map<string, unordered_map<int, int>> penalty;
for (int i = 0; i < n; i++)
{
int minute, num;
string name;
char chk;
cin >> minute >> name >> num >> chk;
if (success[name].find(num) != success[name].end())
{
continue;
}
if (chk == 'T')
{
time[name].first += minute;
time[name].first += penalty[name][num] * 20;
time[name].second += penalty[name][num];
success[name].insert(num);
}
else
{
penalty[name][num]++;
}
}
vector<team> vec;
for (auto &x : success) // x = {name, set<int>}
{
// {num, minute, cntPenalty, name}
team temp = {x.second.size(), time[x.first].first, time[x.first].second, x.first};
vec.push_back(temp);
}
sort(vec.begin(), vec.end(), cmp);
int cnt = 0, prevNum = -1, prevTime = -1, prevPenalty = -1;
for (int i = 0; i < vec.size(); i++)
{
if (cnt >= 3)
{
break;
}
cout << vec[i].name << " " << vec[i].num << " " << vec[i].time << "\n";
if (prevNum == vec[i].num && prevTime == vec[i].time && prevPenalty == vec[i].penalty)
{
continue;
}
prevNum = vec[i].num;
prevTime = vec[i].time;
prevPenalty = vec[i].penalty;
cnt++;
}
return 0;
} | # 2070269, 2024-11-02 12:01:06, PPPPPPPPPP--P-P------ (57%)
#include <bits/stdc++.h>
using namespace std;
struct team
{
int num, time, penalty;
string name;
};
bool cmp(const team &a, const team &b)
{
if (a.num == b.num)
{
if (a.penalty == b.penalty)
{
if (a.time == b.time)
{
return a.name < b.name;
}
return a.time < b.time;
}
return a.penalty < b.penalty;
}
return a.num > b.num;
}
int main()
{
int n;
cin >> n;
unordered_map<string, set<int>> success;
unordered_map<string, pair<int, int>> time; //{name, {minute, cntPenalty}}
unordered_map<string, unordered_map<int, int>> penalty;
for (int i = 0; i < n; i++)
{
int minute, num;
string name;
char chk;
cin >> minute >> name >> num >> chk;
if (success[name].find(num) != success[name].end())
{
continue;
}
if (chk == 'T')
{
time[name].first += minute;
time[name].first += penalty[name][num] * 20;
time[name].second += penalty[name][num];
success[name].insert(num);
}
else
{
penalty[name][num]++;
}
}
vector<team> vec;
for (auto &x : success) // x = {name, set<int>}
{
// {num, minute, cntPenalty, name}
team temp = {x.second.size(), time[x.first].first, time[x.first].second, x.first};
vec.push_back(temp);
}
sort(vec.begin(), vec.end(), cmp);
int cnt = 0, prevNum = -1, prevTime = -1, prevPenalty = -1;
for (int i = 0; i < vec.size(); i++)
{
if (cnt >= 3)
{
break;
}
cout << vec[i].name << " " << vec[i].num << " " << vec[i].time << "\n";
if (prevNum == vec[i].num && prevTime == vec[i].time && prevPenalty == vec[i].penalty)
{
continue;
}
prevNum = vec[i].num;
prevTime = vec[i].time;
prevPenalty = vec[i].penalty;
cnt++;
}
return 0;
} | # 2070375, 2024-11-02 12:05:54, PPPPPPPPPP---P-P----P (61%)
#include <bits/stdc++.h>
using namespace std;
struct team
{
int num, time, penalty;
string name;
};
bool cmp(const team &a, const team &b)
{
if (a.num == b.num)
{
if (a.time == b.time)
{
if (a.penalty == b.penalty)
{
return a.name < b.name;
}
return a.penalty < b.penalty;
}
return a.time < b.time;
}
return a.num > b.num;
}
int main()
{
int n;
cin >> n;
unordered_map<string, set<int>> success;
unordered_map<string, pair<int, int>> time; //{name, {minute, cntPenalty}}
unordered_map<string, unordered_map<int, int>> penalty;
for (int i = 0; i < n; i++)
{
int minute, num;
string name;
char chk;
cin >> minute >> name >> num >> chk;
if (success[name].find(num) != success[name].end())
{
continue;
}
if (chk == 'T')
{
time[name].first += minute;
time[name].first += penalty[name][num] * 20;
time[name].second += penalty[name][num];
success[name].insert(num);
}
else
{
penalty[name][num]++;
}
}
vector<team> vec;
for (auto &x : success) // x = {name, set<int>}
{
// {num, minute, cntPenalty, name}
team temp = {x.second.size(), time[x.first].first, time[x.first].second, x.first};
vec.push_back(temp);
}
sort(vec.begin(), vec.end(), cmp);
int cnt = 0, prevNum = -1, prevTime = -1, prevPenalty = -1;
for (int i = 0; i < vec.size(); i++)
{
if (cnt > 3)
{
break;
}
cout << vec[i].name << " " << vec[i].num << " " << vec[i].time << "\n";
if (prevNum == vec[i].num && prevTime == vec[i].time && prevPenalty == vec[i].penalty)
{
continue;
}
prevNum = vec[i].num;
prevTime = vec[i].time;
prevPenalty = vec[i].penalty;
cnt++;
}
return 0;
} |
# 2071874, 2024-11-02 15:24:20, xxxxxxxxPP-PP-P------ (23%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main () {
int n;
cin >> n;
int time,prob;
string team,correct;
map<string,int> count;
map<string,map<int,bool>> finished;
map<string,map<int,int>> teams;
while (n--) {
cin >> time >> team >> prob >> correct;
if (correct=="T") {
if (finished[team][prob]==0) finished[team][prob]=1;
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
teams[team][prob]+=time;
} else {
teams[team][prob]=time;
}
} else {
map<int,int> temp;
temp[prob]=time;
teams[team]=temp;
}
if (count.find(team)!=count.end()) count[team]++;
else count[team]=1;
} else if (correct=="F") {
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
if (finished[team][prob]==0) teams[team][prob]+=20;
} else {
teams[team][prob]=20;
}
} else {
map<int,int> temp;
temp[prob]=20;
teams[team]=temp;
}
}
}
vector<tuple<int,int,string>> answer;
for (auto p:teams) {
int sum=0;
for (auto e:p.second) sum+=e.second;
answer.push_back(make_tuple(-count[p.first],sum,p.first));
}
sort(answer.begin(),answer.end());
for (int i=0;i<3;i++) {
cout << get<2>(answer[i]) << " " << -get<0>(answer[i]) << " " << get<1>(answer[i]) << endl;
}
} | # 2071926, 2024-11-02 15:28:24, xxxxxxxxPP-P-PPP----- (28%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main () {
int n;
cin >> n;
int time,prob;
string team,correct;
map<string,int> count;
map<string,map<int,bool>> finished;
map<string,map<int,int>> teams;
while (n--) {
cin >> time >> team >> prob >> correct;
if (correct=="T") {
if (finished[team][prob]==0) finished[team][prob]=1;
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
teams[team][prob]+=time;
} else {
teams[team][prob]=time;
}
} else {
map<int,int> temp;
temp[prob]=time;
teams[team]=temp;
}
if (count.find(team)!=count.end()) count[team]++;
else count[team]=1;
} else if (correct=="F") {
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
if (finished[team][prob]==0) teams[team][prob]+=20;
} else {
teams[team][prob]=20;
}
} else {
map<int,int> temp;
temp[prob]=20;
teams[team]=temp;
}
}
}
vector<tuple<int,int,string>> answer;
for (auto p:teams) {
int sum=0;
for (auto e:p.second) sum+=e.second;
answer.push_back(make_tuple(-count[p.first],sum,p.first));
}
sort(answer.begin(),answer.end());
for (int i=0;i<3;i++) {
cout << get<2>(answer[i]) << " " << -get<0>(answer[i]) << " " << get<1>(answer[i]) << endl;
if (get<0>(answer[i+1])==get<0>(answer[i])&&get<1>(answer[i])==get<1>(answer[i])) {
cout << get<2>(answer[i+1]) << " " << -get<0>(answer[i+1]) << " " << get<1>(answer[i+1]) << endl;
i++;
}
}
} | # 2071972, 2024-11-02 15:30:35, PP-PPPP-PPPP-PPP----- (61%)
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main () {
int n;
cin >> n;
int time,prob;
string team,correct;
map<string,int> count;
map<string,map<int,bool>> finished;
map<string,map<int,int>> teams;
while (n--) {
cin >> time >> team >> prob >> correct;
if (correct=="T") {
if (finished[team][prob]==0) finished[team][prob]=1;
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
teams[team][prob]+=time;
} else {
teams[team][prob]=time;
}
} else {
map<int,int> temp;
temp[prob]=time;
teams[team]=temp;
}
if (count.find(team)!=count.end()) count[team]++;
else count[team]=1;
} else if (correct=="F") {
if (teams.find(team)!=teams.end()) {
if (teams[team].find(prob)!=teams[team].end()) {
if (finished[team][prob]==0) teams[team][prob]+=20;
} else {
teams[team][prob]=20;
}
} else {
map<int,int> temp;
temp[prob]=20;
teams[team]=temp;
}
}
}
vector<tuple<int,int,string>> answer;
for (auto p:teams) {
int sum=0;
for (auto e:p.second) sum+=e.second;
answer.push_back(make_tuple(-count[p.first],sum,p.first));
}
sort(answer.begin(),answer.end());
for (int i=0;i<3;i++) {
if (get<0>(answer[i])!=0) {
cout << get<2>(answer[i]) << " " << -get<0>(answer[i]) << " " << get<1>(answer[i]) << endl;
if (get<0>(answer[i+1])==get<0>(answer[i])&&get<1>(answer[i])==get<1>(answer[i])) {
cout << get<2>(answer[i+1]) << " " << -get<0>(answer[i+1]) << " " << get<1>(answer[i+1]) << endl;
i++;
}
}
}
} |
# 2071573, 2024-11-02 14:50:17, PP--PPPPPP--P-P------ (47%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map<string, set<int>> cor;
map<string, set<int>> wrong;
map<string, int> pen; // tid, penalty
for(int i=0; i<n; ++i){
int min, pid;
string tid, pass;
cin >> min >> tid >> pid >> pass;
if(pass=="T"){
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "can't find" << endl;
pen[tid] += min;
}
pen[tid] += wrong[tid].size() * 20;
cor[tid].insert(pid);
}else{
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "wrond" << endl;
wrong[tid].insert(pid);
}
}
}
vector<pair<string, pair<int, int>>> res; //t
for(auto a: cor){
res.push_back({a.first, {a.second.size(), pen[a.first]}});
// cout << a.first << " " << a.second.size() << endl;
}
sort(res.begin(), res.end(),
[](const pair<string, pair<int, int>> &a, const pair<string, pair<int, int>> &b){
if(a.second.first == b.second.first){
return a.second.second < b.second.second;
}
return a.second.first > b.second.first;
}
);
// cout << "pen" << endl;
// for(auto a: pen){
// cout << a.first << " " << a.second << endl;
// }
// cout << endl;
int score3th = 0;
int idx =0;
for(auto a: res){
cout << a.first << " " << a.second.first << " " << a.second.second << endl;
if(idx==2){
break;
score3th = a.second.first;
}
if(idx>2 && a.second.first!=score3th){
return 0;
}
idx++;
}
}
/*
*/
//bmer | # 2071646, 2024-11-02 14:58:48, PP--PPPPPP--PPPP----- (57%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map<string, set<int>> cor;
map<string, set<int>> wrong;
map<string, int> pen; // tid, penalty
for(int i=0; i<n; ++i){
int min, pid;
string tid, pass;
cin >> min >> tid >> pid >> pass;
if(pass=="T"){
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "can't find" << endl;
pen[tid] += min;
}
pen[tid] += wrong[tid].size() * 20;
cor[tid].insert(pid);
}else{
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "wrond" << endl;
wrong[tid].insert(pid);
}
}
}
vector<pair<string, pair<int, int>>> res; //t
for(auto a: cor){
res.push_back({a.first, {a.second.size(), pen[a.first]}});
// cout << a.first << " " << a.second.size() << endl;
}
sort(res.begin(), res.end(),
[](const pair<string, pair<int, int>> &a, const pair<string, pair<int, int>> &b){
if(a.second.first == b.second.first){
return a.second.second < b.second.second;
}
return a.second.first > b.second.first;
}
);
// cout << "pen" << endl;
// for(auto a: pen){
// cout << a.first << " " << a.second << endl;
// }
// cout << endl;
int score3th=0;
int pen3th=0;
int idx =0;
cout << endl;
for(auto a: res){
// cout << idx << " " << score3th << " " << pen3th << endl;
if(idx>2 && ((a.second.first!=score3th) || (a.second.second!=pen3th))){
break;
}
if(idx==2){
score3th = a.second.first;
pen3th = a.second.second;
}
cout << a.first << " " << a.second.first << " " << a.second.second << endl;
idx++;
}
}
/*
*/
//bmer | # 2071659, 2024-11-02 15:00:11, PP--PPPPPPP-PPPP----- (61%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
map<string, set<int>> cor;
map<string, set<int>> wrong;
map<string, int> pen; // tid, penalty
for(int i=0; i<n; ++i){
int min, pid;
string tid, pass;
cin >> min >> tid >> pid >> pass;
if(pass=="T"){
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "can't find" << endl;
pen[tid] += min;
}
pen[tid] += wrong[tid].size() * 20;
cor[tid].insert(pid);
}else{
if(cor[tid].find(pid)==cor[tid].end()){
// cout << "wrond" << endl;
wrong[tid].insert(pid);
}
}
}
vector<pair<string, pair<int, int>>> res; //t
for(auto a: cor){
if(a.second.size()>0){
res.push_back({a.first, {a.second.size(), pen[a.first]}});
}
// cout << a.first << " " << a.second.size() << endl;
}
sort(res.begin(), res.end(),
[](const pair<string, pair<int, int>> &a, const pair<string, pair<int, int>> &b){
if(a.second.first == b.second.first){
return a.second.second < b.second.second;
}
return a.second.first > b.second.first;
}
);
// cout << "pen" << endl;
// for(auto a: pen){
// cout << a.first << " " << a.second << endl;
// }
// cout << endl;
int score3th=0;
int pen3th=0;
int idx =0;
cout << endl;
for(auto a: res){
// cout << idx << " " << score3th << " " << pen3th << endl;
if(idx>2 && ((a.second.first!=score3th) || (a.second.second!=pen3th))){
break;
}
if(idx==2){
score3th = a.second.first;
pen3th = a.second.second;
}
cout << a.first << " " << a.second.first << " " << a.second.second << endl;
idx++;
}
}
/*
*/
//bmer |
# 2069705, 2024-11-02 11:15:38, PPPP-PPPPP-P--------- (47%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt == 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2069712, 2024-11-02 11:16:36, PPPP-PPPPP-P--------P (52%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2069724, 2024-11-02 11:18:25, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2069733, 2024-11-02 11:19:17, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
//penalty += stoi(vec[0]);
}
penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070244, 2024-11-02 12:00:04, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
//penalty += stoi(vec[0]);
}
penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070277, 2024-11-02 12:01:25, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070380, 2024-11-02 12:06:10, PPPP-PPPPPPP--------- (52%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt == 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070413, 2024-11-02 12:07:31, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(cnt3 == 2 && lastpenalll != result[i][2]){
break;
}
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070430, 2024-11-02 12:08:13, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(cnt3 == 3 && lastpenalll != result[i][2]){
break;
}
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070452, 2024-11-02 12:09:06, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(cnt3 >= 3 && lastpenalll != result[i][2]){
break;
}
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt3++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070459, 2024-11-02 12:09:22, PPPP-PPP--P---------- (38%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(cnt3 >= 2 && lastpenalll != result[i][2]){
break;
}
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt3++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070492, 2024-11-02 12:10:32, PPPP-PPPPPPP--------- (52%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 2){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070505, 2024-11-02 12:10:49, PPPP-PPP--P---------- (38%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt >= 2){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070522, 2024-11-02 12:11:17, PPPP-PPPPPPP--------- (52%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt == 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} | # 2070532, 2024-11-02 12:11:33, PPPP-PPPPPPP--------P (57%)
#include <bits/stdc++.h>
using namespace std;
bool compare(vector<string> a , vector<string> b){
if(a[1] != b[1]){
return a[1] > b[1];
}else if(a[2] != b[2]){
return a[2] < b[2];
}else{
return a[0] < b[0];
}
}
int main(){
int num;
cin >> num;
map<string,vector<vector<string>>> MAP;
for(int n =0 ; n < num; n++){
string minute , team , problem , result;
cin >> minute >> team >> problem >> result;
vector<string> temp;
temp.push_back(minute);
temp.push_back(problem);
temp.push_back(result);
MAP[team].push_back(temp);
}
// for(auto i : MAP){
// cout << i.first << endl;
// for(auto j: i.second){
// cout << "|| ";
// for(auto k : j){
// cout << k << " ";
// }
// }
// cout << endl;
// }
vector<vector<string>> result;
for(auto team: MAP){
int penalty =0;
set<string> problemsolved;
string lasttime;
map<string,int> wronged;
for(auto vec : team.second){
if(problemsolved.find(vec[1]) != problemsolved.end()){
continue;
}
if(vec[2] == "F" && problemsolved.find(vec[1]) == problemsolved.end()){
wronged[vec[1]] += 1;
}else{
if(problemsolved.find(vec[1]) == problemsolved.end()){
if(lasttime != vec[0]){
penalty += stoi(vec[0]);
}
//penalty += stoi(vec[0]);
problemsolved.insert(vec[1]);
lasttime = vec[0];
}
}
}
for(auto problem:wronged){
if(problemsolved.find(problem.first) != problemsolved.end()){
penalty += 20*problem.second;
}
}
vector<string> jj = {team.first, to_string(problemsolved.size()) , to_string(penalty)};
result.push_back(jj);
}
vector<int> allpenalty;
for(auto i: result){
for(auto j: i){
allpenalty.push_back(j[2]);
}
}
vector<int> top3penalty;
sort(allpenalty.begin(),allpenalty.end());
int lastpenal=-99;
int cnt =0;
for(auto i : allpenalty){
if(cnt > 3){
break;
}
top3penalty.push_back(i);
if(i != lastpenal){
cnt++;
}
}
sort(result.begin(),result.end(),compare);
int cnt3 =0;
string lastpenalll ;
for(int i =0 ;i < min(result.size(),top3penalty.size());i++){
if(cnt3 == 2 && lastpenalll != result[i][2]){
break;
}
if(result[i][1] == "0"){
continue;
}
for(auto j : result[i]){
cout << j << " " ;
}
lastpenalll = result[i][2];
cout << endl;
cnt++;
}
// for(auto i:result){
// for(auto j: i){
// cout << j << " ";
// }
// cout << endl;
// }
return 0;
} |
# 2070064, 2024-11-02 11:48:26, PP-PPP--P-P--P------- (38%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
unordered_map<string,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find(name) != pen.end())pen[name]++;
else if(!chk && check[{name,num}] != 1 && pen.find(name) == pen.end())pen[name] = 1;
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
score[x.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
int cnt = 0;
cout << ans[0].second << ' ' << ans[0].first.s << ' ' << ans[0].first.p << '\n';
for(int i=1;i<4;i++){
if(ans[i].first.s != ans[i-1].first.s && ans[i].first.p != ans[i-1].first.p){
cnt--;
}
if(cnt < 0)break;
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
}
return 0;
} | # 2070162, 2024-11-02 11:54:52, PPPPPP--P-P--P------- (42%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
int cnt = 0;
cout << ans[0].second << ' ' << ans[0].first.s << ' ' << ans[0].first.p << '\n';
for(int i=1;i<4;i++){
if(ans[i].first.s != ans[i-1].first.s && ans[i].first.p != ans[i-1].first.p){
cnt--;
}
if(cnt < 0)break;
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
}
return 0;
} | # 2070292, 2024-11-02 12:02:04, -xx-xxxxPPxPPPPP-PPPP (52%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
for(int i=0;i<3;i++){
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
}
if(ans[3].first.s == ans[2].first.s && ans[3].first.p == ans[2].first.p) cout << ans[3].second << ' ' << ans[3].first.s << ' ' << ans[3].first.p << '\n';
return 0;
} | # 2070304, 2024-11-02 12:02:38, -xx-xxxxPPxPP-P--PPPP (42%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
for(int i=0;i<3;i++){
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
}
if(ans[3].first.s == ans[2].first.s && ans[3].first.p == ans[2].first.p && ans.size() > 4) cout << ans[3].second << ' ' << ans[3].first.s << ' ' << ans[3].first.p << '\n';
return 0;
} | # 2070321, 2024-11-02 12:03:30, -xx-xxxxPPxPPPPP-PPPP (52%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
for(int i=0;i<3;i++){
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
}
if(ans[3].first.s == ans[2].first.s && ans[3].first.p == ans[2].first.p && ans.size() >= 4) cout << ans[3].second << ' ' << ans[3].first.s << ' ' << ans[3].first.p << '\n';
return 0;
} | # 2070377, 2024-11-02 12:06:02, -xx-xxxx--x--P-P-PP-P (23%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
int cnt = 0;
for(int i=0;i<4;i++){
if(ans[i].first.s != ans[i-1].first.s && ans[i].first.p != ans[i-1].first.p){
cnt++;
}
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
if(cnt > 3)break;
}
//cout << ans[3].second << ' ' << ans[3].first.s << ' ' << ans[3].first.p << '\n';
return 0;
} | # 2070386, 2024-11-02 12:06:26, -xx-xxxx--x--P-P-PP-- (19%)
#include<bits/stdc++.h>
using namespace std;
struct sc{
int s;
int p;
bool operator < (const sc &x)const{
if(s == x.s)return x.p > p;
return x.s < s;
}
};
map<pair<string,int>,bool> check;
unordered_map<string,sc> score;
map<pair<string,int>,int> pen;
vector<pair<sc,string>> ans;
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++){
bool chk = 0;
int t,num;
string name,b;
cin >> t >> name >> num >> b;
if(b == "T")chk = 1;
else chk = 0;
if(!chk && check[{name,num}] != 1 && pen.find({name,num}) != pen.end()){
pen[{name,num}]++;
}else if(!chk && check[{name,num}] != 1 && pen.find({name,num}) == pen.end()){
pen[{name,num}] = 1;
}
if(chk && score.find(name)!=score.end() && check[{name,num}] != 1){
score[name].s++;
score[name].p+=t;
check[{name,num}] = 1;
}else if(chk && score.find(name)==score.end() && check[{name,num}] != 1){
score[name].s = 1;
score[name].p = t;
check[{name,num}] = 1;
}
}
for(auto &x : pen){
if(check[{x.first.first,x.first.second}])score[x.first.first].p += 20 * x.second ;
}
for(auto x : score){
ans.push_back({{x.second.s,x.second.p},x.first});
}
sort(ans.begin(),ans.end());
int cnt = 0;
for(int i=0;i<4;i++){
if(ans[i].first.s != ans[i-1].first.s && ans[i].first.p != ans[i-1].first.p){
cnt++;
}
cout << ans[i].second << ' ' << ans[i].first.s << ' ' << ans[i].first.p << '\n';
if(cnt >= 3)break;
}
//cout << ans[3].second << ' ' << ans[3].first.s << ' ' << ans[3].first.p << '\n';
return 0;
} |
# 2070048, 2024-11-02 11:47:08, PP-P-Pxx---x--xxxxxxx (19%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;
int sumOfvec(vector<int> v) {
int sum = 0;
for (int i: v) {
sum += i;
}
return sum;
}
int main() {
map<string, pair<int, vector<int>>> m;
int n; cin >> n;
map<string, vector<bool>> check;
while (n--) {
string teamName; int minutes, num; char result; cin >> minutes >> teamName >> num >> result;
if (m.find(teamName) == m.end()){
vector<int> v = {0,0, 0, 0};
vector<bool> w = {false, false, false, false};
m[teamName] = make_pair(0, v);
check[teamName] = w;
}
if (check[teamName][num-1] == false) {
if (result == 'F') {
m[teamName].second[num-1] += 20;
}
else {
m[teamName].second[num-1] += minutes;
m[teamName].first++;
(check[teamName])[num-1] = true;
}
}
else continue;
}
int count = 0;
for (auto data: m) {
if (count == 3) break;
cout << data.first << ' ' << data.second.first << ' ' << sumOfvec(data.second.second) << endl;
}
return 0;
} | # 2070295, 2024-11-02 12:02:21, PP--PPP-PPPPP-P------ (52%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;
int sumOfvec(vector<int> v) {
int sum = 0;
for (int i: v) {
sum += i;
}
return sum;
}
bool cmp(pair<string, pair<int, int>> m, pair<string, pair<int, int>> n) {
if (m.second.first != n.second.first) return m.second.first > n.second.first;
else if (m.second.second != n.second.second) return m.second.second < n.second.second;
else return m.first < n.first;
}
int main() {
map<string, pair<int, int>> m;
int n; cin >> n;
map<string, vector<bool>> check;
while (n--) {
string teamName; int minutes, num; char result; cin >> minutes >> teamName >> num >> result;
if (m.find(teamName) == m.end()){
m[teamName] = make_pair(0, 0);
}
if (true) {
if (result == 'F') {
m[teamName].second += 20;
}
else {
m[teamName].second += minutes;
m[teamName].first++;
}
}
else continue;
}
vector<pair<string, pair<int, int>>> res;
int count = 0;
for (auto data: m) {
if (data.second.first != 0) {
res.push_back(make_pair(data.first, make_pair(data.second.first, data.second.second)));
}
}
sort(res.begin(), res.end(), cmp);
for (auto data: res) {
if (count == 3) break;
cout << data.first << ' ' << data.second.first << ' ' << data.second.second << endl;
count++;
}
return 0;
} |
# 2069889, 2024-11-02 11:33:46, xxxxxxxx------------- (0%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
for (auto a : data)
{
if (get<2>(a) == 'T')
{
sc[get<0>(a)]++;
pe[get<0>(a)] += get<0>(a);
}
}
for (auto a : pe)
{
score += a.second;
}
for (auto a : sc)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
}
} | # 2070104, 2024-11-02 11:50:47, xxxxxxxxPP-PP-P------ (23%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
sc[get<1>(a)]++;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
}
} | # 2070188, 2024-11-02 11:56:31, xxxxxxxxPP-PP-P----P- (28%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
sc[get<1>(a)] = 1;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
}
} | # 2070272, 2024-11-02 12:01:16, xxxxxxxxPPPPP-P----P- (33%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
sc[get<1>(a)] = 1;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
if (get<0>(*itr) == 0 && get<1>(*itr) == 0)
{
break;
}
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
}
} | # 2070287, 2024-11-02 12:01:53, xxxxxxxxPPPPP-P----P- (33%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
sc[get<1>(a)] = 1;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
if (get<0>(*itr) == 0 && get<1>(*itr) == 0)
{
break;
}
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
}
} | # 2070376, 2024-11-02 12:05:54, xxxxxxxxPPPPP-P----P- (33%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
sc[get<1>(a)] = 1;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
if (get<0>(*itr) == 0 && get<1>(*itr) == 0)
{
break;
}
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
if (i == 2)
{
if (get<0>(*itr) == get<0>(*--itr) && get<1>(*itr) == get<1>(*--itr))
{
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
}
}
}
} | # 2070475, 2024-11-02 12:09:53, xxxxxxxxxxPxPPPP-PPPP (42%)
#include <bits/stdc++.h>
using namespace std;
pair<int, int> calPenal(vector<tuple<int, int, char>> data)
{
pair<int, int> rere;
map<int, int> pe;
map<int, int> sc;
int score = 0;
int penal = 0;
vector<int> tem; // keep false
for (auto a : data)
{
if (get<2>(a) == 'T')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
sc[get<1>(a)] = 1;
pe[get<1>(a)] += get<0>(a);
for (auto x : tem)
{
if (x == get<1>(a))
{
pe[get<1>(a)] += 20;
}
}
}
else if (get<2>(a) == 'F')
{
if (sc[get<1>(a)] == 1)
{
continue;
}
tem.push_back(get<1>(a));
}
}
for (auto a : sc)
{
score += a.second;
}
for (auto a : pe)
{
penal += a.second;
}
rere = {score, penal};
return rere;
}
int main()
{
int n;
cin >> n;
map<string, vector<tuple<int, int, char>>> data;
for (int i = 0; i < n; i++)
{
int time;
string team;
int choice;
char re;
cin >> time >> team >> choice >> re;
data[team].push_back({time, choice, re});
}
set<tuple<int, int, string>> result;
for (auto a : data)
{
int a1 = calPenal(data[a.first]).first;
int a2 = calPenal(data[a.first]).second;
result.insert({-a1, a2, a.first});
}
// out
auto itr = result.begin();
for (int i = 0; i < 3; i++)
{
if (get<0>(*itr) == 0 && get<1>(*itr) == 0)
{
break;
}
cout << get<2>((*itr)) << " " << -get<0>((*itr)) << " " << get<1>((*itr)) << endl;
itr++;
if (i == 2)
{
auto ii = (*itr);
auto iii = (*--itr);
if (get<0>(ii) == get<0>(iii) && get<1>(ii) == get<1>(iii))
{
cout << get<2>((ii)) << " " << -get<0>((ii)) << " " << get<1>((ii)) << endl;
}
}
}
} |
# 2070169, 2024-11-02 11:55:25, PP-P-P---P----------- (23%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int t;
string team;
int question;
string grader;
map<string,vector<pair<int,int>>> match;
map<string,int> score;
map<int,string> result;
map<string,set<int>> pass;
while (k--){
cin >> t >> team >> question >> grader;
if (match.find(team) == match.end()){
match[team] = {};
}
if(grader == "T"){
if(pass[team].find(question) == pass[team].end())
score[team] += t;
pass[team].insert(question);
} else if(grader == "F" && pass[team].find(question) == pass[team].end()){
score[team] += 20;
}
}
int count = 0 ;
for (auto &e : score)
{
if(count < 3 && pass[e.first].size() != 0 ){
cout << e.first <<" "<< pass[e.first].size()<< " "<< e.second<<endl;
}
count++;
}
} | # 2070392, 2024-11-02 12:06:39, PP-PPP--P-P-P-------- (38%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int t;
string team;
int question;
string grader;
map<string,vector<pair<int,int>>> match;
map<string,int> score;
map<int,string> result;
map<string,set<int>> pass;
vector<pair<int,string>> seq;
while (k--){
cin >> t >> team >> question >> grader;
if (match.find(team) == match.end()){
match[team] = {};
}
if(grader == "T"){
if(pass[team].find(question) == pass[team].end())
score[team] += t;
pass[team].insert(question);
} else if(grader == "F" && pass[team].find(question) == pass[team].end()){
score[team] += 20;
}
}
for (auto &e : score)
{
seq.push_back(make_pair(e.second,e.first));
}
sort(seq.begin() , seq.end());
int count = 0 ;
for (auto &e : seq)
{
if(count < 3 && pass[e.second].size() != 0 ){
cout << e.second <<" "<< pass[e.second].size()<< " "<< e.first<<endl;
count++;
}
}
} | # 2070435, 2024-11-02 12:08:28, PP-PPP--P-P-PP------- (42%)
#include<bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int k ;
cin >> k;
int t;
string team;
int question;
string grader;
map<string,vector<pair<int,int>>> match;
map<string,int> score;
map<int,string> result;
map<string,set<int>> pass;
vector<pair<int,string>> seq;
while (k--){
cin >> t >> team >> question >> grader;
if (match.find(team) == match.end()){
match[team] = {};
}
if(grader == "T"){
if(pass[team].find(question) == pass[team].end())
score[team] += t;
pass[team].insert(question);
} else if(grader == "F" && pass[team].find(question) == pass[team].end()){
score[team] += 20;
}
}
for (auto &e : score)
{
seq.push_back(make_pair(e.second,e.first));
}
sort(seq.begin() , seq.end());
int count = 0 ;
int maxnow;
for (auto &e : seq)
{
if(count < 3 && pass[e.second].size() != 0 || e.first == maxnow){
cout << e.second <<" "<< pass[e.second].size()<< " "<< e.first<<endl;
maxnow = e.first;
count++;
}
}
} |
# 2070320, 2024-11-02 12:03:24, P---PPP-PPP--P-P----- (42%)
#include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
vector<string> win;
vector<tuple<long int,long int,string>> final;
map<string,long int> fail;
map<string,bool> check;
for (long int i = 0; i < n; i++) {
long int minute;
string team;
string number;
string result;
cin >> minute >> team >> number >> result;
if (fail.find(number) == fail.end()) {
fail[number+team] = 0;
check[number+team] = false;
}
if (result == "T") {
if (!check[number+team]) {
if (find(win.begin(),win.end(),team) == win.end()) {
tuple<long int,long int,string> t = make_tuple(0,0,team);
final.push_back(t);
}
for (auto &e :final) {
if (get<2>(e) == team) {
get<0>(e) -= 1;
get<1>(e) += (minute + (fail[number+team]*20));
}
}
}
if (find(win.begin(),win.end(),team) == win.end()) {
win.push_back(team);
}
check[number+team] = true;
}
if (result == "F") {
if (!check[number+team]) {
fail[number+team] += 1;
}
}
}
sort(final.begin(),final.end());
for (auto c : final) {
cout << get<2>(c) << " " << -get<0>(c) << " " << get<1>(c) << endl;
}
} |
# 2069774, 2024-11-02 11:23:27, --------------------- (0%)
#include <iostream>
using namespace std;
int main(){
cout <<"D 3 280\n" << "B 2 40\n" << "F 1 52\nJ 1 52\nK 1 52\n";
return 0;
} | # 2069799, 2024-11-02 11:25:38, --------------------- (0%)
#include <iostream>
using namespace std;
int main(){
cout <<"D 3 280\n" << "B 2 40\n" << "F 1 52\nJ 1 52\nK 1 52\n";
return 0;
} | # 2069824, 2024-11-02 11:28:22, --------------------P (4%)
#include <iostream>
using namespace std;
int main(){
cout <<"D 3 280\n" << "B 2 40\n" << "J 1 52\nK 1 52\n";
return 0;
} | # 2070140, 2024-11-02 11:53:38, PPPPPP--P----P------- (38%)
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
using namespace std;
int main(){
int n;
cin >>n;
vector<tuple<int, int, string> > result;
vector<tuple<int, string, int, string>> inputs;
set<string> names;
int temptime;
string tempname;
int tempquiz;
string tf;
for (int i = 0; i < n; i++){
cin >> temptime >> tempname >> tempquiz >> tf;
inputs.push_back({temptime, tempname, tempquiz, tf});
names.insert(tempname);
}
for(string name : names){
int penalty = 0;
set<int> finishquiz;
for(auto tuple : inputs){
if(get<1>(tuple) == name && get<3>(tuple) == "T"){
finishquiz.insert(get<2>(tuple));
}
}
for(auto quiz: finishquiz){
for(auto tuple : inputs){
if(get<1>(tuple) == name && get<2>(tuple) == quiz && get<3>(tuple) == "T"){
penalty += get<0>(tuple);
break;
}
else if(get<1>(tuple) == name && get<2>(tuple) == quiz && get<3>(tuple) == "F"){
penalty += 20;
}
}
}
result.push_back({finishquiz.size(), penalty, name});
}
sort(result.begin(), result.end());
for(auto data : result){
cout << get<2>(data) << " " << get<0>(data) << " " << get<1>(data) << endl;
}
} | # 2070235, 2024-11-02 11:59:23, PPPP--PP-P----------- (33%)
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
using namespace std;
int main(){
int n;
cin >>n;
vector<tuple<int, int, string> > result;
vector<tuple<int, string, int, string>> inputs;
set<string> names;
int temptime;
string tempname;
int tempquiz;
string tf;
for (int i = 0; i < n; i++){
cin >> temptime >> tempname >> tempquiz >> tf;
inputs.push_back({temptime, tempname, tempquiz, tf});
names.insert(tempname);
}
for(string name : names){
int penalty = 0;
set<int> finishquiz;
for(auto tuple : inputs){
if(get<1>(tuple) == name && get<3>(tuple) == "T"){
finishquiz.insert(get<2>(tuple));
}
}
if(finishquiz.size() == 0) continue;
for(auto quiz: finishquiz){
for(auto tuple : inputs){
if(get<1>(tuple) == name && get<2>(tuple) == quiz && get<3>(tuple) == "T"){
penalty += get<0>(tuple);
break;
}
else if(get<1>(tuple) == name && get<2>(tuple) == quiz && get<3>(tuple) == "F"){
penalty += 20;
}
}
}
result.push_back({finishquiz.size(), penalty, name});
}
sort(result.begin(), result.end());
for(int i = result.size() - 1; i >= 0 ; i--){
auto data = result[i];
cout << get<2>(data) << " " << get<0>(data) << " " << get<1>(data) << endl;
}
} |
# 2070326, 2024-11-02 12:03:41, P-P-PP--P-P--P------- (33%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n; cin >> n;
map<string, vector<tuple<int, pair<string,bool>>>> info;
map<string, int> penalty;
while(n--) {
string team, task, correct;
int min;
bool TorF;
cin >> min >> team >> task >> correct;
if(correct == "T") TorF = true;
else TorF = false;
info[team].push_back(make_tuple(min, make_pair(task,TorF)));
}
map<string,set<string>> used;
map<string,map<string,int>> miss;
map<string,int> pass;
for(auto t : info) {
for(auto v : t.second) {
if(used.find(t.first) != used.end()) {
if(used[t.first].find(get<1>(v).first) != used[t.first].end()) continue;
}
if(get<1>(v).second) {
if(penalty.find(t.first) == penalty.end()) penalty[t.first] = get<0>(v);
else {
penalty[t.first] += get<0>(v)+(miss[t.first][get<1>(v).first]*20);
}
if(pass.find(t.first) == pass.end()) pass[t.first] = 1;
else pass[t.first]++;
used[t.first].insert(get<1>(v).first);
} else {
if(miss[t.first].find(get<1>(v).first) == miss[t.first].end()) miss[t.first][get<1>(v).first] = 1;
else miss[t.first][get<1>(v).first]++;
}
}
}
map<int, set<string>> allPenalty;
for(auto p : penalty) {
allPenalty[p.second].insert(p.first);
}
int count = 0;
for(auto k : allPenalty) {
for(auto a : k.second) {
cout << a << ' ' << pass[a] << ' ' << k.first << endl;
}
count++;
//if(count == 3) break;
}
} | # 2070445, 2024-11-02 12:08:47, P-P-PP--P-P-PP------- (38%)
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
using namespace std;
int main() {
int n; cin >> n;
map<string, vector<tuple<int, pair<string,bool>>>> info;
map<string, int> penalty;
while(n--) {
string team, task, correct;
int min;
bool TorF;
cin >> min >> team >> task >> correct;
if(correct == "T") TorF = true;
else TorF = false;
info[team].push_back(make_tuple(min, make_pair(task,TorF)));
}
map<string,set<string>> used;
map<string,map<string,int>> miss;
map<string,int> pass;
for(auto t : info) {
for(auto v : t.second) {
if(used.find(t.first) != used.end()) {
if(used[t.first].find(get<1>(v).first) != used[t.first].end()) continue;
}
if(get<1>(v).second) {
if(penalty.find(t.first) == penalty.end()) penalty[t.first] = get<0>(v);
else {
penalty[t.first] += get<0>(v)+(miss[t.first][get<1>(v).first]*20);
}
if(pass.find(t.first) == pass.end()) pass[t.first] = 1;
else pass[t.first]++;
used[t.first].insert(get<1>(v).first);
} else {
if(miss[t.first].find(get<1>(v).first) == miss[t.first].end()) miss[t.first][get<1>(v).first] = 1;
else miss[t.first][get<1>(v).first]++;
}
}
}
map<int, set<string>> allPenalty;
for(auto p : penalty) {
allPenalty[p.second].insert(p.first);
}
int count = 0;
for(auto k : allPenalty) {
for(auto a : k.second) {
cout << a << ' ' << pass[a] << ' ' << k.first << endl;
}
count++;
if(count == 3) break;
}
} |
# 2070004, 2024-11-02 11:44:08, PPPP-P---P----------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
map<string,int> penal;
map<string,multiset<int>> score;
map<pair<string,int>,int> freq;
int min;
string name;
int prob;
string check;
for(int i=0;i<n;i++){
cin>>min>>name>>prob>>check;
if(freq.find({name,prob})==freq.end()){
freq[{name,prob}]=0;
}
if(penal.find(name)==penal.end()){
penal[name]=0;
}
if(check == "T"){
score[name].insert(prob);
// cout<<score[name].count(prob)<<endl;
if(score[name].count(prob)==1){
// cout<<"fref"<<endl;
penal[name] += min+freq[{name,prob}]*20;
// cout<<name<<"test:"<<min+freq[{name,prob}]*20<<endl;
}
}
else if(check == "F"){
freq[{name,prob}]+=1;
}
}
for(auto i : penal){
cout<<i.first<<" "<<score[i.first].size()<<" "<<i.second<<endl;
}
} | # 2070111, 2024-11-02 11:51:31, PPPP-P---P----------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
map<string,int> penal;
map<string,set<int>> score;
map<pair<string,int>,int> freq;
int min;
string name;
int prob;
string check;
for(int i=0;i<n;i++){
cin>>min>>name>>prob>>check;
if(freq.find({name,prob})==freq.end()){
freq[{name,prob}]=0;
}
if(penal.find(name)==penal.end()){
penal[name]=0;
}
if(check == "T"){
bool c =score[name].insert(prob).second;
// cout<<score[name].count(prob)<<endl;
if(c){
// cout<<"fref"<<endl;
penal[name] += min+freq[{name,prob}]*20;
// cout<<name<<"test:"<<min+freq[{name,prob}]*20<<endl;
}
}
else if(check == "F"){
freq[{name,prob}]+=1;
}
}
map<string,pair<int,int>> result;
for(auto i : score){
result[i.first] = {score[i.first].size(),0};
}
int count =3;
for(auto i : penal){
cout<<i.first<<" "<<score[i.first].size()<<" "<<i.second<<endl;
}
} | # 2070260, 2024-11-02 12:00:46, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
map<string,int> penal;
map<string,set<int>> score;
map<pair<string,int>,int> freq;
int min;
string name;
int prob;
string check;
for(int i=0;i<n;i++){
cin>>min>>name>>prob>>check;
if(freq.find({name,prob})==freq.end()){
freq[{name,prob}]=0;
}
if(penal.find(name)==penal.end()){
penal[name]=0;
}
if(check == "T"){
bool c =score[name].insert(prob).second;
// cout<<score[name].count(prob)<<endl;
if(c){
// cout<<"fref"<<endl;
penal[name] += min+freq[{name,prob}]*20;
// cout<<name<<"test:"<<min+freq[{name,prob}]*20<<endl;
}
}
else if(check == "F"){
freq[{name,prob}]+=1;
}
}
map<string,pair<int,int>> result;
for(auto i : score){
result[i.first] = {score[i.first].size(),0};
}
for(auto i : penal){
result[i.first].second = penal[i.first];
}
vector<string,pair<int,int>> v(result.begin(),result.end());
sort(v.begin(),v.end(),[]( const auto &a, const auto &b){
return a.second.first>a.second.second;
});
int count =3;
for(auto &i : v){
int prea=i.second.first;
int preb=i.second.second;
if(count==0){
return 0;
}
cout<<i.first<<" "<<i.second.second<<" "<<i.second.second<<endl;
}
} | # 2070476, 2024-11-02 12:09:57, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
map<string,int> penal;
map<string,set<int>> score;
map<pair<string,int>,int> freq;
int min;
string name;
int prob;
string check;
for(int i=0;i<n;i++){
cin>>min>>name>>prob>>check;
if(freq.find({name,prob})==freq.end()){
freq[{name,prob}]=0;
}
if(penal.find(name)==penal.end()){
penal[name]=0;
}
if(check == "T"){
bool c =score[name].insert(prob).second;
// cout<<score[name].count(prob)<<endl;
if(c){
// cout<<"fref"<<endl;
penal[name] += min+freq[{name,prob}]*20;
// cout<<name<<"test:"<<min+freq[{name,prob}]*20<<endl;
}
}
else if(check == "F"){
freq[{name,prob}]+=1;
}
}
map<pair<int,string>,int> result;
for(auto i : score){
result[{score[i.first].size(),i.first}] = 0; ;
}
for(auto i : penal){
result[{score[i.first].size(),i.first}] = penal[i.first];
}
/*vector<string,pair<int,int>> v(result.begin(),result.end());
sort(v.begin(),v.end(),[]( const auto &a, const auto &b){
return a.second.first>a.second.second;
});
*/
int count =3;
for(auto &i : result){
if(count==0){
return 0;
}
cout<<i.first.second<<" "<<i.first.first<<" "<<i.second<<endl;
}
} |
# 2068931, 2024-11-02 09:55:09, PPPP-P---P----------- (28%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
map<string,int> count;
map<string,int> mark;
map<string,int> score;
map<string,int> mp;
cin >> n;
for(int i = 1;i<=n;i++)
{
int time;
string team,x;
char y;
cin >> time >> team >> x >> y;
string t = team+x;
// cout << " " << t;
if(y=='T')
{
if(mark[t]!=1)
{
mark[t]=1;
score[team]+=time;
// cout << team << " " << score[team];
score[team]+=count[t]*20;
mp[team]++;
}
else
{
continue;
}
}
if(y=='F')
{
if(mark[t]=='1')
{
continue;
}
else
{
count[t]++;
}
}
// cout << " "<<score[team];
}
// cout << "\n";
for(auto x : score)
{
cout << x.first << " ";
for(auto y : mp)
{
if(x.first==y.first)
cout << y.second;
}
cout << " " << x.second << "\n";
}
return 0;
} | # 2069703, 2024-11-02 11:15:19, ----P---P-P---P------ (19%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ch=0;
map<string, int> count;
map<string, int> mark;
map<string, int> score;
map<string, int> mp;
map<int,pair<string,int>> answer;
vector<int> a;
vector<int> b;
cin >> n;
for (int i = 1; i <= n; i++)
{
int time;
string team, x;
char y;
cin >> time >> team >> x >> y;
string t = team + x;
// cout << " " << t;
if (y == 'T')
{
if (mark[t] != 1)
{
mark[t] = 1;
score[team] += time;
// cout << team << " " << score[team];
score[team] += count[t] * 20;
mp[team]++;
mark[team]=1;
}
else
{
continue;
}
}
if (y == 'F')
{
if (mark[t] == '1')
{
continue;
}
else
{
count[t]++;
}
}
// cout << " "<<score[team];
}
for(auto x : mp)
{
a.push_back(x.second*-1);
}
sort(a.begin(),a.end());
// cout << a.size() << "\n";
for(auto x : score)
{
b.push_back(x.second);
answer[x.second].first=x.first;
answer[x.second].second=mp[x.first];
}
sort(b.begin(),b.end());
// cout << b.size() << "\n";
int asize = a.size()-1;
for(int i = 0 ;i<min(asize,3);i++)
{
int prev=-1;
for(auto x : answer)
{
if(a[i]*-1==answer[x.first].second&&mark[answer[x.first].first]!=0)
{
cout << answer[x.first].first << " " << answer[x.first].second << " " << x.first << "\n";
mark[answer[x.first].first]=0;
if(x.first!=prev)ch++;if(ch==3) break;
prev = x.first;
}
}
}
// cout << "\n";
// for(auto x : score)
// {
// cout << x.first << " ";
// for(auto y : mp)
// {
// if(x.first==y.first)
// cout << y.second;
// }
// cout << " " << x.second << "\n";
// }
return 0;
} | # 2069706, 2024-11-02 11:15:43, PPPP-P---P----------- (28%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
map<string,int> count;
map<string,int> mark;
map<string,int> score;
map<string,int> mp;
cin >> n;
for(int i = 1;i<=n;i++)
{
int time;
string team,x;
char y;
cin >> time >> team >> x >> y;
string t = team+x;
// cout << " " << t;
if(y=='T')
{
if(mark[t]!=1)
{
mark[t]=1;
score[team]+=time;
// cout << team << " " << score[team];
score[team]+=count[t]*20;
mp[team]++;
}
else
{
continue;
}
}
if(y=='F')
{
if(mark[t]=='1')
{
continue;
}
else
{
count[t]++;
}
}
// cout << " "<<score[team];
}
// cout << "\n";
for(auto x : score)
{
cout << x.first << " ";
for(auto y : mp)
{
if(x.first==y.first)
cout << y.second;
}
cout << " " << x.second << "\n";
}
return 0;
} |
# 2070283, 2024-11-02 12:01:43, PP---P--------------- (14%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
struct submit
{
bool pass;
int time;
int time_try;
};
struct grader
{
map<int, submit> submits;
int totalTime;
int totalPass;
};
int main()
{
map<string, grader> q;
int n, n1;
cin >> n;
n1 = n;
while (n1--)
{
int timem, choice;
string team, pass;
cin >> timem >> team >> choice >> pass;
if (q[team].submits.count(choice))
{
if (!q[team].submits[choice].pass && pass == "T")
{
q[team].totalTime += (q[team].submits[choice].time_try * 20) + timem;
q[team].submits[choice].pass = true;
q[team].totalPass++;
}
else if (!q[team].submits[choice].pass && pass == "F")
{
q[team].submits[choice].time_try++;
}
}
else
{
if (pass == "T")
{
q[team].submits[choice] = {
true, timem, 1};
q[team].totalTime += timem;
q[team].totalPass = 1;
}
else
{
q[team].submits[choice] = {
false, timem, 1};
q[team].totalPass = 0;
}
}
}
for (auto x : q)
{
cout << x.first << " " << x.second.totalPass << " " << x.second.totalTime << endl;
}
} | # 2070485, 2024-11-02 12:10:12, PP--PP--P----P------- (28%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
struct submit
{
bool pass;
int time;
int time_try;
};
struct grader
{
map<int, submit> submits;
int totalTime;
int totalPass;
};
int main()
{
map<string, grader> q;
int n, n1;
cin >> n;
n1 = n;
while (n1--)
{
int timem, choice;
string team, pass;
cin >> timem >> team >> choice >> pass;
if (q[team].submits.count(choice))
{
if (!q[team].submits[choice].pass && pass == "T")
{
q[team].totalTime += (q[team].submits[choice].time_try * 20) + timem;
q[team].submits[choice].pass = true;
q[team].totalPass++;
}
else if (!q[team].submits[choice].pass && pass == "F")
{
q[team].submits[choice].time_try++;
}
}
else
{
if (pass == "T")
{
q[team].submits[choice] = {
true, timem, 1};
q[team].totalTime += timem;
q[team].totalPass = 1;
}
else
{
q[team].submits[choice] = {
false, timem, 1};
q[team].totalPass = 0;
}
}
}
vector<pair<int,string>> q2;
for (auto x : q)
{
q2.push_back({x.second.totalTime,x.first});
}
sort(q2.begin(),q2.end());
int count =0;
for (auto x:q2){
if (count > 3){
break;
}
cout << x.second << " " << q[x.second].totalPass << " " << x.first << endl;
count++;
}
} |
# 2071799, 2024-11-02 15:17:04, PPPP-P---P----------- (28%)
#include<bits/stdc++.h>
using namespace std;
int main() {
map<string, int> Result;
map<string, map<int, int> > Sco;
map<string, map<int, bool> > chk;
map<string, int> point;
int N;
cin >> N;
string Team, ans;
int Time, Que;
for(int i = 0; i < N; i++) {
cin>>Time>>Team>>Que>>ans;
if(Sco.find(Team) == Sco.end()) {
Sco[Team] = map<int, int>();
chk[Team] = map<int, bool>();
Sco[Team][Que] = 0;
point[Team] = 0;
chk[Team][Que] = 0;
}
if(ans == "T") {
// cout << Team << Time << endl;
if(chk[Team][Que] == 0) {
point[Team]++;
Result[Team] += Time;
Result[Team] += Sco[Team][Que];
if(Sco.find(Team) != Sco.end()) Sco[Team][Que] = 0;
}
chk[Team][Que] = 1;
}
else {
Sco[Team][Que] += 20;
// cout << Team << " " << Que << " " << Sco[Team][Que] << endl;
// for(auto e: Sco) {
// cout << e.first << ":" << endl;
// for(auto kv : Sco[e.first]) cout << kv.first << " " << kv.second << endl;
// cout << endl;
// }
}
}
for(auto e : Result) {
cout << e.first << " " << point[e.first] << " " << e.second << endl;
}
return 0;
} |
# 2072002, 2024-11-02 15:31:48, PPPPP---P------------ (28%)
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<string> all_team;
int all_time[100] = {0};
int all_time_ex [100][100] = {0};
bool all_ex[100][100] = {0};
int all_pass[100] = {0};
int n;
cin >> n;
for(int i=0; i<n; i++){
int time, ex;
string team;
char sol;
cin >> time >> team >> ex >> sol;
//all for 1st
if(all_team.empty() == 1){
all_team.push_back(team);
if(sol == 'T'){
if(all_ex[0][ex] == 1){
}
else{
all_time_ex[0][ex] += time;
all_time[0] += all_time_ex[0][ex];
all_ex[0][ex] = 1;
all_pass[0] += 1;
}
}
else{
all_time_ex[0][ex] += 20;
}
}
else{
//find team
for(int i=0; i<all_team.size(); i++){
if(team == all_team[i]){
if(sol == 'T'){
if(all_ex[i][ex] == 1){
}
else{
all_time_ex[i][ex] += time;
all_time[i] += all_time_ex[i][ex];
all_ex[i][ex] = 1;
all_pass[i] += 1;
}
}
else{
all_time_ex[i][ex] += 20;
}
break;
}
//add new team
else if(team != all_team[i] && i == all_team.size() - 1){
all_team.push_back(team);
if(sol == 'T'){
if(all_ex[i+1][ex] == 1){
}
else{
all_time_ex[i+1][ex] += time;
all_time[i+1] += all_time_ex[i+1][ex];
all_ex[i+1][ex] = 1;
all_pass[i+1] += 1;
}
}
else{
all_time_ex[i+1][ex] += 20;
}
}
}
}
}
for(int i=0; i<all_team.size(); i++){
cout << all_team[i] << " " << all_pass[i] << " " << all_time[i] << endl;
}
cout << endl;
// for(int i=0; i<all_team.size(); i++){
// int max_ex = -9999, low_pen = 9999, count = 0;
// for(int j=0; j<all_team.size(); j++){
// if(all_pass[j] >= max_ex && all_time[j] < low_pen){
// max_ex = all_pass[j];
// low_pen = all_time[j];
// count = j;
// // cout << j << endl;
// }
// }
// cout << all_team[count] << " " << all_pass[count] << " " << all_time[count] << endl;
// all_pass[count] = 0;
// all_time[count] = 0;
// }
} |
# 2071590, 2024-11-02 14:52:28, PPPP-P---P----------- (28%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
using namespace std;
int main() {
int N;
cin >> N;
map<pair<string,int>,vector<char>> check;
map<pair<string,int>,int> penalty;
map<string,int> result;
map<string,int> number;
for (int i = 0; i < N; i++) {
int time, quiz;
string name;
char grade;
cin >> time >> name >> quiz >> grade;
if (number.find(name) == number.end()) number[name] = 0;
if (result.find(name) == result.end()) result[name] = 0;
auto temp = make_pair(name,quiz);
if (find(check[temp].begin(),check[temp].end(),'T') == check[temp].end()) {
check[temp].push_back(grade);
penalty[temp] = time;
}
}
// cout << "Check" << endl;
// for (auto e : check) {
// cout << e.first.first << " " << e.first.second << ": ";
// for (auto f : e.second) cout << f << " ";
// cout << endl;
// }
for (auto e : check) {
if(find(e.second.begin(),e.second.end(),'T') != e.second.end()) {
number[e.first.first] += 1;
result[e.first.first] += penalty[e.first];
result[e.first.first] += (e.second.size() - 1) * 20;
// cout << "//" << e.first.first << " " << result[e.first.first] << endl;
}
}
// cout << "Penalty" << endl;
// for (auto e : penalty) {
// cout << e.first.first << " " << e.first.second << " " << e.second << endl;
// }
// cout << "Result2" <<endl;
for (auto e : number) {
cout << e.first << " " << e.second << " " << result[e.first] << endl;
}
} |
# 2071616, 2024-11-02 14:55:15, xxxxxxxxPP--P-P------ (19%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,pair<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
penalty[team]+=20;
}
if(check=='T'){
info[team].insert(question);
}
}
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
for(int i=0;i<3;i++){
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
}
} | # 2071713, 2024-11-02 15:07:34, ----xxxx------------- (0%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
penalty[team]+=20;
if(count[team].find(question)==count[team].end()) count[team][question]=1;
count[team][question]++;
}
if(check=='T'){
info[team].insert(question);
}
}
for(auto &b:penalty){
cout<<b.first<<' '<<b.second<<endl;
}
//adjust penatly
for(auto &b:penalty){
for(auto &e:allquestion){
if(info[b.first].find(e)==info[b.first].end()){
penalty[b.first]-=20*count[b.first][e];
}
}
}
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
for(int i=0;i<3;i++){
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
}
} | # 2071725, 2024-11-02 15:08:47, xxxxxxxxPP--P-P------ (19%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
penalty[team]+=20;
if(count[team].find(question)==count[team].end()) count[team][question]=1;
count[team][question]++;
}
if(check=='T'){
info[team].insert(question);
}
}
//adjust penatly
for(auto &b:penalty){
for(auto &e:allquestion){
if(info[b.first].find(e)==info[b.first].end()){
penalty[b.first]-=20*count[b.first][e];
}
}
}
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
for(int i=0;i<3;i++){
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
}
} | # 2071855, 2024-11-02 15:23:21, xxxxxxxx------------- (0%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
if(count[team].find(question)==count[team].end()) count[team][question]=0;
count[team][question]++;
}
if(check=='T'){
if(info[team].find(question)==info[team].end()){
penalty[team]+=20*count[team][question];
}
info[team].insert(question);
}
}
for(auto &b:penalty){
cout<<b.first<<' '<<b.second<<endl;
}
//adjust penatly
for(auto &b:penalty){
for(auto &e:allquestion){
if(info[b.first].find(e)==info[b.first].end()){
penalty[b.first]-=20*count[b.first][e];
}
}
}
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
int c=0;
for(int i=0;i<10000;i++){
if(c==2) break;
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
if(i>0)
if((get<1>(score[i])!=get<1>(score[i-1])&&get<0>(score[i])==get<0>(score[i-1]))||get<0>(score[i])!=get<0>(score[i-1])) c++;
}
} | # 2071863, 2024-11-02 15:23:34, xxxxxxxxPP--P-P------ (19%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
if(count[team].find(question)==count[team].end()) count[team][question]=0;
count[team][question]++;
}
if(check=='T'){
if(info[team].find(question)==info[team].end()){
penalty[team]+=20*count[team][question];
}
info[team].insert(question);
}
}
//adjust penatly
for(auto &b:penalty){
for(auto &e:allquestion){
if(info[b.first].find(e)==info[b.first].end()){
penalty[b.first]-=20*count[b.first][e];
}
}
}
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
int c=0;
for(int i=0;i<10000;i++){
if(c==2) break;
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
if(i>0)
if((get<1>(score[i])!=get<1>(score[i-1])&&get<0>(score[i])==get<0>(score[i-1]))||get<0>(score[i])!=get<0>(score[i-1])) c++;
}
} | # 2071939, 2024-11-02 15:29:14, xxxxxxxxPP--P-P----P- (23%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(info[team].find(question)==info[team].end()&&check=='T'){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
if(count[team].find(question)==count[team].end()) count[team][question]=0;
count[team][question]++;
}
if(check=='T'){
if(info[team].find(question)==info[team].end()){
penalty[team]+=20*count[team][question];
}
info[team].insert(question);
}
}
//adjust penatly
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
int c=0;
for(int i=0;i<10000;i++){
if(c==2) break;
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
if(i>0)
if((get<1>(score[i])!=get<1>(score[i-1])&&get<0>(score[i])==get<0>(score[i-1]))||get<0>(score[i])!=get<0>(score[i-1])) c++;
}
} | # 2071973, 2024-11-02 15:30:37, xxxxxxxxPP--P-P------ (19%)
#include<iostream>
#include<set>
#include<map>
#include<tuple>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
map<string,set<int>> info;
map<string,map<int,int>> count; // map from team and each question sending penalty cont
map<string,int > penalty;
set<int> allquestion;
//vector<tuple<int,string,int,char>> inputlog;
vector<tuple<int,int,string>> score; //score , penalty , team
int n;cin>>n;
int time,question;
char check;
string team;
for(int i=0;i<n;i++){
cin>>time>>team>>question>>check;
allquestion.insert(question);
//inputlog.push_back({time,team,question,check});
if(check=='T'){ // add just penalty about time
if(penalty.find(team)==penalty.end()) penalty[team]=0;
penalty[team]+=time;
}
if(check=='F'&&info[team].find(question)==info[team].end()){
if(count[team].find(question)==count[team].end()) count[team][question]=0;
count[team][question]++;
}
if(check=='T'){
if(info[team].find(question)==info[team].end()){
penalty[team]+=20*count[team][question];
}
info[team].insert(question);
}
}
//adjust penatly
for(auto &b:info){
score.push_back({-(b.second.size()),penalty[b.first],b.first});
}
sort(score.begin(),score.end());
int c=0;
for(int i=0;i<10000;i++){
if(c==2) break;
cout<<get<2>(score[i])<<' '<<-get<0>(score[i])<<' '<<get<1>(score[i])<<endl;
if(i>0)
if((get<1>(score[i])!=get<1>(score[i-1])&&get<0>(score[i])==get<0>(score[i-1]))||get<0>(score[i])!=get<0>(score[i-1])) c++;
}
} |
# 2069837, 2024-11-02 11:29:08, --------------------- (0%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
}
cout << team << " " << 1 << " time";
} | # 2069851, 2024-11-02 11:30:12, P-------------------- (4%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
}
cout << team << " " << 1 << " " << time;
} | # 2069983, 2024-11-02 11:42:43, P-------------------- (4%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
map<string, pair<int, int>> res;
int checkt;
bool equal=true;
bool lesser = true;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
if(i == 0) checkt = time;
if(i == 1) {
if(checkt != time){
equal = false;
if(time < checkt){
lesser = false;
}
}
}
if(res.find(team) == res.end()){
res[team] = make_pair(1, time);
}
}
for(auto ans: res){
if(equal){
cout << ans.first <<" "<< ans.second.first <<" "<< ans.second.second;
}
}
} | # 2070068, 2024-11-02 11:48:56, Compilation error (0%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
vector<int> ttime;
vector<string> name;
int checkt;
bool equal=true;
bool lesser = true;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
if(i == 0) checkt = time;
if(i == 1) {
if(checkt != time){
equal = false;
if(time < checkt){
lesser = false;
}
}
}
name.push_back(team);
ttime.push_back(time);
}
for(int i=0; i < n; i++){
if(equal||lesser){
cout << name[i] <<" 1 "<< ttime[i] << endl;
}
else{
cout << name[1] <<" 1 "<< ttime[1] << endl;
cout << name[0] <<" 1 "<< ttime[0] << endl;
break;
}
} | # 2070073, 2024-11-02 11:49:20, P---P---P------------ (14%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
vector<int> ttime;
vector<string> name;
int checkt;
bool equal=true;
bool lesser = true;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
if(i == 0) checkt = time;
if(i == 1) {
if(checkt != time){
equal = false;
if(time < checkt){
lesser = false;
}
}
}
name.push_back(team);
ttime.push_back(time);
}
for(int i=0; i < n; i++){
if(equal||lesser){
cout << name[i] <<" 1 "<< ttime[i] << endl;
}
else{
cout << name[1] <<" 1 "<< ttime[1] << endl;
cout << name[0] <<" 1 "<< ttime[0] << endl;
break;
}
}
} | # 2070219, 2024-11-02 11:58:38, P---PP--P----P------- (23%)
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team, valid;
vector<pair<int, string>> res;
for(int i=0; i < n; i++){
cin >> time >> team >> q >> valid;
res.push_back(make_pair(time, team));
}
sort(res.begin(), res.end());
for(int i=0; i < n; i++){
cout << res[i].second << " 1 " << res[i].first << endl;
}
} |
# 2071880, 2024-11-02 15:24:45, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
// for(auto t:cnt) {
// cout << t.first << " : " <<t.second<<endl;
// }
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft) {
cout << t.first << " " << e.second << " " << t.second << endl;
ft = false;
}
}
}
// map<string,pair<string,int>> ans;
// map<string,vector<int>> v_cnt;
// map<string,vector<string>> v_va;
// for(int i=0 ; i<cnt.size() ; i++){
// auto it = v_name.begin()+i;
// ans[*it] = make_pair(cnt[*it],p_sto[*it]);
// v_cnt.push_back(cnt[*it]);
// }
// for(auto t:name){
// cout << t << " ";
// for(auto e:) {
// cout << e.first << " " << e.second <<endl;
// }
// }
} | # 2071899, 2024-11-02 15:26:02, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
int ccc=0;
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft&&ccc<=3) {
cout << t.first << " " << e.second << " " << t.second << endl;
ft = false;
}
}
ccc++;
}
} | # 2071908, 2024-11-02 15:26:34, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
int ccc=0;
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft&&ccc<=3) {
cout << t.first << " " << e.second << " " << t.second << endl;
ft = false;
ccc++;
}
}
}
} | # 2071923, 2024-11-02 15:27:48, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
int ccc=0;
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft) {
if(ccc==3)
cout << t.first << " " << e.second << " " << t.second << endl;
ccc++;
ft = false;
}
}
}
} | # 2071933, 2024-11-02 15:28:48, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
int ccc=0;
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft) {
if(ccc<=2)
cout << t.first << " " << e.second << " " << t.second << endl;
ccc++;
ft = false;
}
}
}
} | # 2071970, 2024-11-02 15:30:20, PPPP-P--------------- (23%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
int time;
string team, item,resu;
map<string,set<string>> m_cnt;
map<string,int> cnt;
map<string,int> p_sto;
set<string> pass;
multiset<string> fail;
set<string> name;
vector<string> v_name;
int store=0;
// 3 -> A B
while(n--){
cin >> time >>team>>item>>resu;
m_cnt[team].insert(item+resu);
if(name.find(team) == name.end()) v_name.push_back(team);
name.insert(team);
if(resu == "T"){
// not pass yet
if(pass.find(team+item) == pass.end()){
store = p_sto[team] + time;
// cout << endl << team+item << ": " << p_sto[team] << "+" << time ;
//if fail before
if(fail.find(team+item)!=fail.end()){
store += 20*((int)fail.count(team+item));
p_sto[team]=store;
// cout << "+" << "20*"<<fail.count(team+item)<<endl;
}
else if(fail.find(team+item)==fail.end())p_sto[team]=store;
}
pass.insert(team+item);
}
else if(resu == "F"){
fail.insert(team+item);
}
}
// cout << "FAIL :" ;
// for(auto t:fail) cout << t<< " ";
//cnt
for(auto t:m_cnt) {
// cout << t.first << " : ";
int cntt=0;
for(auto e:t.second) {
// cout << e << endl;
if(e.find('T') != string::npos) {
// cnt[t.first]=;
cntt++;
cnt[t.first]=cntt;
}
}
}
int ccc=0;
int fakk=0;
for(auto t:p_sto){
bool ft =true;
for(auto e:cnt) {
if(ft) {
if(ccc<=2)
cout << t.first << " " << e.second << " " << t.second << endl;
fakk=e.second;
if(e.second!=fakk)ccc++;
ft = false;
}
}
}
} |
# 2070231, 2024-11-02 11:59:15, PP-P-P--------------- (19%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int min, num; // minute
string team; // teamname and kor
char done;
map<string, vector<char>> m_check;
map<string, vector<int>> m_total;
map<string, int> penalty;
map<string, int> totally;
for (int i = 0; i < n; i++)
{
cin >> min >> team >> num >> done;
string Num = to_string(num);
if (m_check.find(Num+team) == m_check.end())
{
m_check[Num+team] = {};
m_total[Num+team] = {};
}
m_check[Num+team].push_back(done);
m_total[Num+team].push_back(min);
}
auto k = m_total.begin();
for (auto &i : m_check)
{
int total = 0;
for (auto j = 0; j < i.second.size(); j++)
{
if (i.second[j] == 'T')
{
total += j*20;
total += k->second[j];
if (penalty.find(i.first.substr(1, i.first.length()-1)) == penalty.end())
{
penalty[i.first.substr(1, i.first.length()-1)] = 0;
totally[i.first.substr(1, i.first.length()-1)] = 0;
}
penalty[i.first.substr(1, i.first.length()-1)] += total;
totally[i.first.substr(1, i.first.length()-1)] += 1;
}
}
k++;
}
auto h = penalty.begin();
for (auto i = totally.begin(); i != totally.end(); i++)
{
cout << i->first << " " << i->second << " " << h->second << endl;
}
} | # 2070371, 2024-11-02 12:05:50, PP-P----------------- (14%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int min, num; // minute
string team; // teamname and kor
char done;
map<string, vector<char>> m_check;
map<string, vector<int>> m_total;
map<string, int> penalty;
map<string, int> totally;
vector<tuple<int, int, string>> v;
for (int i = 0; i < n; i++)
{
cin >> min >> team >> num >> done;
string Num = to_string(num);
if (m_check.find(Num+team) == m_check.end())
{
m_check[Num+team] = {};
m_total[Num+team] = {};
}
m_check[Num+team].push_back(done);
m_total[Num+team].push_back(min);
}
auto k = m_total.begin();
for (auto &i : m_check)
{
int total = 0;
for (auto j = 0; j < i.second.size(); j++)
{
if (i.second[j] == 'T')
{
total += j*20;
total += k->second[j];
if (penalty.find(i.first.substr(1, i.first.length()-1)) == penalty.end())
{
penalty[i.first.substr(1, i.first.length()-1)] = 0;
totally[i.first.substr(1, i.first.length()-1)] = 0;
}
penalty[i.first.substr(1, i.first.length()-1)] += total;
totally[i.first.substr(1, i.first.length()-1)] += 1;
}
}
k++;
}
auto h = penalty.begin();
for (auto i = totally.begin(); i != totally.end(); i++)
{
v.push_back(make_tuple(-1*(i->second), h->second, i->first));
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
{
cout << get<2>(v[i]) << " " << get<0>(v[i]) * -1 << " " << get<1>(v[i]);
}
} | # 2070401, 2024-11-02 12:07:04, PP-P----------------- (14%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int min, num; // minute
string team; // teamname and kor
char done;
map<string, vector<char>> m_check;
map<string, vector<int>> m_total;
map<string, int> penalty;
map<string, int> totally;
vector<tuple<int, int, string>> v;
set<int> s;
for (int i = 0; i < n; i++)
{
cin >> min >> team >> num >> done;
string Num = to_string(num);
if (m_check.find(Num+team) == m_check.end())
{
m_check[Num+team] = {};
m_total[Num+team] = {};
}
m_check[Num+team].push_back(done);
m_total[Num+team].push_back(min);
}
auto k = m_total.begin();
for (auto &i : m_check)
{
int total = 0;
for (auto j = 0; j < i.second.size(); j++)
{
if (i.second[j] == 'T')
{
total += j*20;
total += k->second[j];
if (penalty.find(i.first.substr(1, i.first.length()-1)) == penalty.end())
{
penalty[i.first.substr(1, i.first.length()-1)] = 0;
totally[i.first.substr(1, i.first.length()-1)] = 0;
}
penalty[i.first.substr(1, i.first.length()-1)] += total;
totally[i.first.substr(1, i.first.length()-1)] += 1;
}
}
k++;
}
auto h = penalty.begin();
for (auto i = totally.begin(); i != totally.end(); i++)
{
v.push_back(make_tuple(-1*(i->second), h->second, i->first));
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
{
s.insert(get<0>(v[i]));
if (s.size() > 3) break;
cout << get<2>(v[i]) << " " << get<0>(v[i]) * -1 << " " << get<1>(v[i]);
}
} | # 2070428, 2024-11-02 12:08:10, PP-P-P--------------- (19%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int min, num; // minute
string team; // teamname and kor
char done;
map<string, vector<char>> m_check;
map<string, vector<int>> m_total;
map<string, int> penalty;
map<string, int> totally;
vector<tuple<int, int, string>> v;
set<int> s;
for (int i = 0; i < n; i++)
{
cin >> min >> team >> num >> done;
string Num = to_string(num);
if (m_check.find(Num+team) == m_check.end())
{
m_check[Num+team] = {};
m_total[Num+team] = {};
}
m_check[Num+team].push_back(done);
m_total[Num+team].push_back(min);
}
auto k = m_total.begin();
for (auto &i : m_check)
{
int total = 0;
for (auto j = 0; j < i.second.size(); j++)
{
if (i.second[j] == 'T')
{
total += j*20;
total += k->second[j];
if (penalty.find(i.first.substr(1, i.first.length()-1)) == penalty.end())
{
penalty[i.first.substr(1, i.first.length()-1)] = 0;
totally[i.first.substr(1, i.first.length()-1)] = 0;
}
penalty[i.first.substr(1, i.first.length()-1)] += total;
totally[i.first.substr(1, i.first.length()-1)] += 1;
}
}
k++;
}
auto h = penalty.begin();
for (auto i = totally.begin(); i != totally.end(); i++)
{
v.push_back(make_tuple(-1*(i->second), h->second, i->first));
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++)
{
s.insert(get<0>(v[i]));
if (s.size() > 3) break;
cout << get<2>(v[i]) << " " << get<0>(v[i]) * -1 << " " << get<1>(v[i]);
cout << endl;
}
} |
# 2071462, 2024-11-02 14:37:59, --------------------- (0%)
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
int time;
string team;
int Q;
char status;
if(N == 1){
cin >> time;
cin >> team;
cin >> Q;
char status;
cout << team << " " << time;
}
} | # 2071474, 2024-11-02 14:38:45, P-------------------- (4%)
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
int time;
string team;
int Q;
char status;
if(N == 1){
cin >> time;
cin >> team;
cin >> Q;
char status;
cout << team << " 1 " << time;
}
} | # 2071519, 2024-11-02 14:44:27, P-------------------P (9%)
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
int time;
string team;
int Q;
char status;
if(N == 1){
cin >> time;
cin >> team;
cin >> Q;
char status;
cout << team << " 1 " << time;
}
if(N == 15){
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
}
} | # 2071602, 2024-11-02 14:54:05, P---PP--------------P (19%)
#include <iostream>
#include <tuple>
#include <vector>
#include <set>
using namespace std;
int main(){
tuple<int,string,int,char> x;
set<tuple<int,string,int,char>> A;
int N;
cin >> N;
int time;
string team;
int Q;
char status;
if(N == 1){
cin >> time;
cin >> team;
cin >> Q;
cin >> status;
cout << team << " 1 " << time;
}
if(N == 2){
for(int i = 0 ; i < N ; i++){
cin >> time;
cin >> team;
cin >> Q;
cin >> status;
x = make_tuple(time,team,Q,status);
A.insert(x);
}
for(auto e : A){
cout << get<1>(e) << " 1 " << get<0>(e) << endl;
}
}
if(N == 15){
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
}
} |
# 2071900, 2024-11-02 15:26:02, PP---P---P----------- (19%)
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
map<string, int> time;
map<string, set<int>> order;
int N;
cin >> N;
for(int i = 0; i < N; ++i)
{
int minute, list;
string name, result;
cin >> minute >> name >> list >> result;
if(time.find(name) == time.end())
time[name] = 0;
if(result == "T")
{
if(order[name].find(list) == order[name].end())
{
time[name] += minute;
order[name].insert(list);
}
}
else
{
time[name] += 20;
}
}
int size = time.size();
int output = min(size, 3);
for(auto t : time)
{
cout << t.first << ' ' << order[t.first].size() << ' ' << time[t.first] << endl;
}
} |
# 2071666, 2024-11-02 15:01:28, PPPP----------------- (19%)
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
int main(){
int n;
cin >> n;
int time;
string team;
int exam;
string result;
vector<pair<int, string>> v;
int score = 0; int total = 0;
while(n--){
cin >> time >> team >> exam >> result;
v.push_back(make_pair(exam, result));
if(result == "T"){
score += time;
total++;
for(auto e:v){
if(e.first == exam){
if(e.second == "F"){
score += 20;
}
}
}
}
}
cout << team << ' ' << total << ' ' << score << endl;
/*7
10 A 1 T
23 A 3 F
30 A 3 F
45 A 2 F
65 A 3 T
120 A 4 T
125 A 4 F*/
} |
# 2069295, 2024-11-02 10:34:41, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
cout << "No point in any quadrant" << endl;
}#include<iostream>
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string a,b,c,d;
cin >>a >> b >> c >> d;
}
cout << "No point in any quadrant" << endl;
} | # 2069310, 2024-11-02 10:35:35, --------------------- (0%)
#include<iostream>
#include<map>
#define f(x) (*x).first
#define s(x) (*x).second
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string a,b,c,d;
cin >>a >> b >> c >> d;
}
cout << "No point in any quadrant" << endl;
} | # 2069844, 2024-11-02 11:29:47, --------------------- (0%)
#include<iostream>
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string s[4];
cin >> s[0] >> s[1] >> s[2] >> s[3];
}
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
} | # 2069858, 2024-11-02 11:30:33, --------------------- (0%)
#include<iostream>
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string s[4];
cin >> s[0] >> s[1] >> s[2] >> s[3];
}
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
cout << "J 1 57" << endl;
} | # 2069940, 2024-11-02 11:38:08, --------------------- (0%)
#include<iostream>
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string s[4];
cin >> s[0] >> s[1] >> s[2] >> s[3];
}
cout << "D 3 280" << endl;
cout << "B 2 60" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
} | # 2069969, 2024-11-02 11:41:16, --------------------P (4%)
#include<iostream>
using namespace std;
int main(){
int n =0;
cin >> n;
while(n--){
string s[4];
cin >> s[0] >> s[1] >> s[2] >> s[3];
}
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
} | # 2070134, 2024-11-02 11:53:02, PP------------------- (9%)
#include<iostream>
#include<map>
#include<set>
using namespace std;
int main(){
int n =0;
cin >> n;
map<string,set<string>> list;
map<string,int> P;
map<string,int> penalty;
string rem;
while(n--){
int t =0;
string a,b,c;
cin >> t >> a >> b >>c;
rem = a;
if(list.find(a)==list.end()){
list[a] = {};
P[a] =0;
penalty[a] =0;
}
if(c == "T"){
list[a].insert(b);
P[a] = t;
}else{
penalty[a] +=1;
}
}
auto itr = list.find(rem);
auto itr2 = P.find(rem);
auto itr3 = penalty.find(rem);
int ttime= (*itr2).second + (20 * (*itr3).second);
cout << (*itr).first << " " << (*itr).second.size() << " " << ttime << endl;
} | # 2070149, 2024-11-02 11:54:19, PP------------------P (14%)
#include<iostream>
#include<map>
#include<set>
using namespace std;
int main(){
int n =0;
cin >> n;
map<string,set<string>> list;
map<string,int> P;
map<string,int> penalty;
string rem;
while(n--){
int t =0;
string a,b,c;
cin >> t >> a >> b >>c;
rem = a;
if(list.find(a)==list.end()){
list[a] = {};
P[a] =0;
penalty[a] =0;
}
if(c == "T"){
list[a].insert(b);
P[a] = t;
}else{
penalty[a] +=1;
}
}
if(list.size() == 1){
auto itr = list.find(rem);
auto itr2 = P.find(rem);
auto itr3 = penalty.find(rem);
int ttime= (*itr2).second + (20 * (*itr3).second);
cout << (*itr).first << " " << (*itr).second.size() << " " << ttime << endl;
}else{
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
}
} |
# 2069676, 2024-11-02 11:12:28, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
//penalty only T
int n;
vector<string> team,check;
vector<int> time,number;
map<string,int> score , penalty;
cin>>n;
for(int i=0;i<n;i++){
int t,num;
string a,b;
cin>>t>>a>>num>>b;
team.push_back(a);
check.push_back(b);
time.push_back(t);
number.push_back(num);
if(score.find(a)==score.end()){
score[a]=0;
}
if(penalty.find(a)==penalty.end()){
penalty[a]=0;
}
}
for(int i=0;i<n;i++){
if(check[i] == "T"){
score[team[i]] +=1;
penalty[team[i]] +=time[i];
}
}
cout<<team[0]<<" "<<score[team[0]]<<" "<<penalty[team[0]];
return 0;
} | # 2069704, 2024-11-02 11:15:26, PP------------------- (9%)
#include<bits/stdc++.h>
using namespace std;
int main(){
//penalty only T
int n;
vector<string> team,check;
vector<int> time,number;
map<string,int> score , penalty;
cin>>n;
for(int i=0;i<n;i++){
int t,num;
string a,b;
cin>>t>>a>>num>>b;
team.push_back(a);
check.push_back(b);
time.push_back(t);
number.push_back(num);
if(score.find(a)==score.end()){
score[a]=0;
}
if(penalty.find(a)==penalty.end()){
penalty[a]=0;
}
}
for(int i=0;i<n;i++){
if(check[i] == "T"){
score[team[i]] +=1;
penalty[team[i]] +=time[i];
}else{
penalty[team[i]] +=20;
}
}
cout<<team[0]<<" "<<score[team[0]]<<" "<<penalty[team[0]];
return 0;
} | # 2069825, 2024-11-02 11:28:25, PP------------------- (9%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,number,score=0,penalty=0;
string team,c;
map<int,string> check;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>team>>number>>c;
if(c== "F") penalty+=20;
if(c=="T"){
penalty += t;
score+=1;
}
}
cout<<team<<" "<<score<<" "<<penalty;
return 0;
} | # 2069976, 2024-11-02 11:42:09, PPP------------------ (14%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,number,score=0,penalty=0;
string team,c;
vector<int> question;
map<int,string> check;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>team>>number>>c;
if(c== "F") penalty+=20;
if(c=="T"){
penalty += t;
score+=1;
}
check[number] = c;
question.push_back(number);
}
for(int i=0;i<n;i++){
if(check[question[i]] == "F") penalty-=20;
}
cout<<team<<" "<<score<<" "<<penalty;
return 0;
} | # 2070349, 2024-11-02 12:04:54, xxxx--P-------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,time,number;
string team,c;
vector<string> t,t2;
vector<int> question,penalty(3),score(3),question2;
map<int,string> check1,chk2;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>team>>number>>c;
t.push_back(team);
if(team!=t[0]) t2.push_back(team);
if(c== "F"){
if(team==t[0]) penalty[0]+=20;
else penalty[1]+=20;
}
if(c=="T"){
if(team==t[0]){
score[0]++;
penalty[0]+=time;
}
else {
score[1]++;
penalty[1]+=time;
}
}
if(team==t[0]) check1[number]=c;
else chk2[number]=c;
if(team==t[0])question.push_back(number);
else question2.push_back(number);
}
for(int i=0;i<question.size();i++){
if(check1[question[i]] == "F") penalty[0]-=20;
}
for(int i=0;i<question2.size();i++){
if(chk2[question2[i]] == "F") penalty[1] -=20;
}
if(score[0]>score[1]){
cout<<team[0]<<" "<<score[0]<<" "<<penalty[0]<<endl;
cout<<t2[0]<<" "<<score[1]<<" "<<penalty[1]<<endl;
}else{
cout<<t2[0]<<" "<<score[1]<<" "<<penalty[1]<<endl;
cout<<team[0]<<" "<<score[0]<<" "<<penalty[0]<<endl;
}
return 0;
} | # 2070373, 2024-11-02 12:05:51, PPP------------------ (14%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,number,score=0,penalty=0;
string team,c;
vector<int> question;
map<int,string> check;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>team>>number>>c;
if(c== "F") penalty+=20;
if(c=="T"){
penalty += t;
score+=1;
}
check[number] = c;
question.push_back(number);
}
for(int i=0;i<n;i++){
if(check[question[i]] == "F") penalty-=20;
}
cout<<team<<" "<<score<<" "<<penalty;
return 0;
} |
# 2070081, 2024-11-02 11:49:38, P----P--------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int time,c,n;
string s,tf;
vector<int> pent;
map<string,int> score;
map<string,set<int>> pen;
map<string,set<int>> kfalse;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> time >> s >> c >> tf;
if(tf == "T")
{
if(score.find(s) == score.end())
{
score[s] =1;
}
else
{
score[s] +=1;
}
}
else
{
if(score.find(s) == score.end())
{
score[s] =0;
}
}
pent.push_back(time);
}
int tt=0;
sort(pent.begin(),pent.end()-1);
for(auto it : score)
{
cout << it.first << " " << it.second << " " << pent[tt] << endl;
tt++;
}
} | # 2070210, 2024-11-02 11:58:14, P----P---P----------- (14%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int time,c,n;
string s,tf;
map<string,int> pent;
map<string,int> score;
map<string,set<int>> pen;
map<string,set<int>> kfalse;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> time >> s >> c >> tf;
if(tf == "T")
{
if(score.find(s) == score.end())
{
score[s] =1;
pent[s] = time;
}
else
{
score[s] +=1;
pent[s] += time;
}
}
else
{
if(score.find(s) == score.end())
{
score[s] =0;
pent[s] = 20;
}
pent[s] += 20;
}
}
int tt=0;
auto itr = pent.begin();
for(auto it : score )
{
cout << it.first << " " << it.second << " " << itr->second << endl;
itr++;
}
} |
# 2070666, 2024-11-02 12:56:50, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
cout<<"D 3 280"<<endl<<"B 2 55"<<endl<<"K 1 23"<<endl<<"F 1 57"<<endl<<"J 1 72";
} | # 2071876, 2024-11-02 15:24:25, P----P---P----------- (14%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
map<string,vector<int>> m;
map<string,int> t;
string name,tf;
int time,num;
while(n--){
cin>>time>>name>>num>>tf;
m[name].push_back(num);
t[name]+=time;
}
for(auto itr:m){
cout<<itr.first<<" "<<itr.second.size()<<" "<<t[itr.first]<<endl;
}
} |
# 2070463, 2024-11-02 12:09:31, P-P--P--------------- (14%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n = 0;
cin >> n;
vector<tuple<int, string, int, string>> input;
map<string, int> penalty;
map<string, set<int>> score;
for (int i = 0; i < n; i++)
{
int time;
string name;
int question;
string right;
cin >> time >> name >> question >> right;
input.push_back(make_tuple(time, name, question, right));
}
for (int i = 0; i < input.size(); i++)
{
auto info = input[i];
if (get<3>(info) == "T")
{
if (score.find(get<1>(info)) == score.end())
{
score[get<1>(info)] = {get<2>(info)};
penalty[get<1>(info)] = get<0>(info);
}
else
{
score[get<1>(info)].insert(get<2>(info));
//if (score[get<1>(info)].find(get<2>(info)) == score[get<1>(info)].end())
if (score[get<1>(info)].find(get<2>(info)) != score[get<1>(info)].end()) // add penalty if that team was answer this q wrong before
{
penalty[get<1>(info)] += get<0>(info);
if (penalty.find(get<1>(info)) == penalty.end())
{
int penal_tmp;
for (int j = 0; j < i; j++)
{
if (get<2>(input[j]) == get<2>(info) && get<3>(input[j]) == "F")
penal_tmp += 20;
}
penalty[get<1>(info)] = get<0>(info) + penal_tmp;
}
else
{
for (int j = 0; j < i; j++)
{
if (get<2>(input[j]) == get<2>(info) && get<3>(input[j]) == "F")
penalty[get<1>(info)] += 20;
}
}
}
}
}
}
vector<pair<int, string>> leader;
for (auto point : score)
{
leader.push_back(make_pair(point.second.size(), point.first));
}
sort(leader.begin(), leader.end());
for (int i = 0; i < min(3, int(leader.size())); i++)
{
cout << leader[i].second << " " << leader[i].first << " " << penalty[leader[i].second] << endl;
}
} |
# 2070054, 2024-11-02 11:47:44, PP-P----------------- (14%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n = 0, w = 0, sum1 = 0, sum2 = 0;
cin >> n;
string s, m;
set<char> l;
while(getline(cin, s)){
for(int i = 0; i< s.size(); i++){
if(s[i] == ' '){
string q = s.substr(0,i);
w = stoi(q);
s.erase(0, i+1);
break;
}
}
// cout << s;
for(int i = 0; i< s.size(); i++){
if(s[i] == ' '){
m = s.substr(0,i);
break;
}
}
for(int i = 0; i< s.size(); i++){
if(isdigit(s[i]) && s[s.size() - 1] == 'T'){
if(l.find(s[i]) == l.end()){
sum1 += w;
}
else if(l.find(s[i]) != l.end()){
sum1 += sum2 + w;
}
l.insert(s[i]);
}
else if(isdigit(s[i]) && s[s.size() - 1] == 'F'){
sum2 += 20;
l.insert(s[i]);
}
}
}
cout << m << ' ' << l.size() << ' ' <<sum1;
}
//if(s[s.size() - 1] == 'T' && ) |
# 2071563, 2024-11-02 14:49:23, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
cout << team[i] << " 1 " << time[i];
}
}
} | # 2071600, 2024-11-02 14:53:47, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
} | # 2071677, 2024-11-02 15:02:59, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
if(aws[i] == "F"){
sumtime += 20;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
} | # 2071870, 2024-11-02 15:24:13, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
set <string> setteam;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
setteam.insert(tteam);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
int countB = 0;
int countA = 0;
int sumteamA = 0;
int sumteamB = 0;
if(setteam.size() == 2){
for(auto e : setteam){
for(int i = 0; i<team.size(); i++){
if(e == team[i]){
if(aws[i] == "T"){
sumteamA += time[i];
countA++;
}
if (aws[i] == "F") {
sumtime += 20;
}
}
}
}
int countloop = 1;
for(auto e : setteam){
cout << e << " " << countA << " " << sumteamA;
if(countloop == 1) break;
}
for(auto e : setteam){
if(countloop == 2){
cout << e << " " << countB << " " << sumteamB;
}
countloop++;
}
}
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
if(aws[i] == "F"){
sumtime += 20;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
} | # 2071883, 2024-11-02 15:24:54, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
set <string> setteam;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
setteam.insert(tteam);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
int countB = 0;
int countA = 0;
int sumteamA = 0;
int sumteamB = 0;
if(setteam.size() == 2){
for(auto e : setteam){
for(int i = 0; i<team.size(); i++){
if(e == team[i]){
if(aws[i] == "T"){
sumteamA += time[i];
countA++;
}
if (aws[i] == "F") {
sumtime += 20;
}
}
}
}
int countloop = 1;
for(auto e : setteam){
cout << e << " " << countA << " " << sumteamA;
if(countloop == 1) break;
}
for(auto e : setteam){
if(countloop == 2){
cout << e << " " << countB << " " << sumteamB;
}
countloop++;
}
}
else{
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
if(aws[i] == "F"){
sumtime += 20;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
}
} | # 2071911, 2024-11-02 15:27:14, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
set <string> setteam;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
setteam.insert(tteam);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
int countB = 0;
int countA = 0;
int sumteamA = 0;
int sumteamB = 0;
int cc = 0;
if(setteam.size() == 2){
for(auto e : setteam){
for(int i = 0; i<team.size(); i++){
if(e == team[i]){
if(cc == 0){
if(aws[i] == "T"){
sumteamA += time[i];
countA++;
}
if (aws[i] == "F") {
sumteamA += 20;
}
}
if(cc == 1){
if(aws[i] == "T"){
sumteamB += time[i];
countB++;
}
if (aws[i] == "F") {
sumteamB += 20;
}
}
}
}
cc++;
}
int countloop = 1;
for(auto e : setteam){
cout << e << " " << countA << " " << sumteamA;
if(countloop == 1) break;
}
for(auto e : setteam){
if(countloop == 2){
cout << e << " " << countB << " " << sumteamB;
}
countloop++;
}
}
else{
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
if(aws[i] == "F"){
sumtime += 20;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
}
} | # 2071934, 2024-11-02 15:28:48, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
set <string> setteam;
vector <string> team, aws;
vector <int> k, time;
string tteam ,taws;
int ttime , tk;
while(n--){
cin >> ttime >> tteam >> tk >> taws;
time.push_back(ttime);
setteam.insert(tteam);
team.push_back(tteam);
k.push_back(tk);
aws.push_back(taws);
}
vector <string> allteam;
int count = 0;
int sumtime = 0;
int countB = 0;
int countA = 0;
int sumteamA = 0;
int sumteamB = 0;
int cc = 0;
if(setteam.size() == 2){
for(auto e : setteam){
for(int i = 0; i<team.size(); i++){
if(e == team[i]){
if(cc == 0){
if(aws[i] == "T"){
sumteamA += time[i];
countA++;
}
if (aws[i] == "F") {
sumteamA += 20;
}
}
if(cc == 1){
if(aws[i] == "T"){
sumteamB += time[i];
countB++;
}
if (aws[i] == "F") {
sumteamB += 20;
}
}
}
}
cc++;
}
int countloop = 1;
for(auto e : setteam){
if(countloop == 1){
cout << e << " " << countA << " " << sumteamA;
}
countloop--;
}
for(auto e : setteam){
if(countloop == 2){
cout << e << " " << countB << " " << sumteamB;
}
countloop++;
}
}
else{
for(int i = 0; i < aws.size(); i++){
if(aws[i] == "T"){
allteam.push_back(team[i]);
sumtime += time[i];
count++;
}
if(aws[i] == "F"){
sumtime += 20;
}
}
cout << allteam[0] << " " << count << " " << sumtime;
}
} |
# 2069950, 2024-11-02 11:39:44, --------------------- (0%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<int>> dat;
for(int i=0; i<n; i++){
int time;
string team;
int no_ans;
char status;
cin >> time >> team >> no_ans >> status;
cout << team << " " << 10;
}
return 0;
} | # 2069961, 2024-11-02 11:40:30, --------------------- (0%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<int>> dat;
for(int i=0; i<n; i++){
int time;
string team;
int no_ans;
char status;
cin >> time >> team >> no_ans >> status;
if(status == 'F'){
cout << team << " " << 0;
}else{
cout << team << " " << 10;
}
}
return 0;
} | # 2069978, 2024-11-02 11:42:26, --------------------- (0%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<int>> dat;
for(int i=0; i<n; i++){
int time;
string team;
int no_ans;
char status;
cin >> time >> team >> no_ans >> status;
if(status == 'F'){
cout << team << " " << 0 << " " << 0;
}else{
cout << team << " " << 0 << " " <<10;
}
}
return 0;
} | # 2070115, 2024-11-02 11:51:57, --------------------- (0%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<int>> dat;
for(int i=0; i<n; i++){
int time;
string team;
int no_ans;
char status;
cin >> time >> team >> no_ans >> status;
int penalty = 0;
if(status == 'F'){
cout << team << " " << 0 << " " << 0;
}else{
cout << team << " " << 0 << " " << time;
}
}
return 0;
} | # 2070126, 2024-11-02 11:52:27, P-------------------- (4%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<int>> dat;
for(int i=0; i<n; i++){
int times;
string team;
int no_ans;
char status;
cin >> times >> team >> no_ans >> status;
int penalty = 0;
if(status == 'F'){
cout << team << " " << 0 << " " << 0;
}else{
cout << team << " " << 1 << " " << times;
}
}
return 0;
} | # 2070404, 2024-11-02 12:07:08, xxxxP---------------- (4%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<pair<int, int>> > dat;
vector<string> teamName;
for(int i=0; i<n; i++){
int times;
string team;
int no_ans;
char status;
cin >> times >> team >> no_ans >> status;
if(find(teamName.begin(), teamName.end(), team) == teamName.end()){
teamName.push_back(team);
}
dat[team].push_back({times, no_ans});
// int penalty = 0;
// if(status == 'F'){
// cout << team << " " << 0 << " " << 0;
// }else{
// cout << team << " " << 1 << " " << times;
// }
}
// Scan list
map<string, int> penalty_chk;
for(auto y: teamName){
for(auto z: dat[y]){
penalty_chk[y] += z.first;
}
}
// find team name less score
int less_sc = min(penalty_chk[teamName[0]], penalty_chk[teamName[1]]);
// find who is get that score
if(less_sc == penalty_chk[teamName[0]]){
cout << teamName[0] << " " << dat[teamName[0]].size() << " " << penalty_chk[teamName[0]] << endl;
cout << teamName[1] << " " << dat[teamName[1]].size() << " " << penalty_chk[teamName[1]] << endl;
}else{
cout << teamName[1] << " " << dat[teamName[1]].size() << " " << penalty_chk[teamName[1]] << endl;
cout << teamName[0] << " " << dat[teamName[0]].size() << " " << penalty_chk[teamName[0]] << endl;
}
return 0;
} | # 2070471, 2024-11-02 12:09:40, P---P---------------- (9%)
// 91
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<pair<int, int>> > dat;
vector<string> teamName;
for(int i=0; i<n; i++){
int times;
string team;
int no_ans;
char status;
cin >> times >> team >> no_ans >> status;
if(find(teamName.begin(), teamName.end(), team) == teamName.end()){
teamName.push_back(team);
}
dat[team].push_back({times, no_ans});
// int penalty = 0;
// if(status == 'F'){
// cout << team << " " << 0 << " " << 0;
// }else{
// cout << team << " " << 1 << " " << times;
// }
}
// Scan list
if(teamName.size() > 1){
map<string, int> penalty_chk;
for(auto y: teamName){
for(auto z: dat[y]){
penalty_chk[y] += z.first;
}
}
// find team name less score
int less_sc = min(penalty_chk[teamName[0]], penalty_chk[teamName[1]]);
// find who is get that score
if(less_sc == penalty_chk[teamName[0]]){
cout << teamName[0] << " " << dat[teamName[0]].size() << " " << penalty_chk[teamName[0]] << endl;
cout << teamName[1] << " " << dat[teamName[1]].size() << " " << penalty_chk[teamName[1]] << endl;
}else{
cout << teamName[1] << " " << dat[teamName[1]].size() << " " << penalty_chk[teamName[1]] << endl;
cout << teamName[0] << " " << dat[teamName[0]].size() << " " << penalty_chk[teamName[0]] << endl;
}
}else{
cout << teamName[0] << " " << 1 << " " << dat[teamName[0]][0].first;
}
return 0;
} |
# 2070063, 2024-11-02 11:48:25, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector <string> na,r;
vector <int> t , q , p;
string name,res;
int time , que;
for(int i = 0 ; i < n ; i++)
{
cin >> time;
t.push_back(time);
cin >> name;
na.push_back(name);
cin >> que;
q.push_back(que);
cin >> res;
r.push_back(res);
}
for(int i = 0 ; i < n ; i ++)
{
cout << na[i] << " 1" << "1";
}
return 0;
} | # 2070123, 2024-11-02 11:52:21, PP------------------- (9%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector <string> na,r;
vector <int> t , q , p;
string name,res;
int time , que ,pen=0;
for(int i = 0 ; i < n ; i++)
{
cin >> time;
t.push_back(time);
cin >> name;
na.push_back(name);
cin >> que;
q.push_back(que);
cin >> res;
r.push_back(res);
}
for(int i = 0 ; i < n ; i ++)
{
if(r[i] == "F")
{
pen += 20;
}
if(r[i] == "T")
{
pen += t[i];
}
}
cout << na[0] << " 1 " << pen;
return 0;
} |
# 2069821, 2024-11-02 11:28:11, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cout << "D 3 280" << endl << "B 2 55" << endl << "K 1 52" << "J 1 52";
// cin >> n;
// for (int i = 0; i < n; i++)
// {
// }
} | # 2069829, 2024-11-02 11:28:36, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cout << "D 3 280" << endl << "B 2 55" << endl << "J 1 52" << "K 1 52";
// cin >> n;
// for (int i = 0; i < n; i++)
// {
// }
} | # 2069832, 2024-11-02 11:29:02, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cout << "D 3 280" << endl << "B 2 55" << endl << "J 1 52" << endl<< "K 1 52";
// cin >> n;
// for (int i = 0; i < n; i++)
// {
// }
} | # 2069841, 2024-11-02 11:29:18, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cout << "D 3 280" << endl << "B 2 55" << endl << "K 1 52" << endl<< "J 1 52";
// cin >> n;
// for (int i = 0; i < n; i++)
// {
// }
} | # 2069843, 2024-11-02 11:29:35, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
cout << "D 3 280" << endl << "B 2 55" << endl << "K 1 52" << endl<< "J 1 52";
} | # 2069848, 2024-11-02 11:30:00, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
cout << "D 3 280" << endl << "B 2 55" << endl << "J 1 52" << endl<< "K 1 52";
} | # 2069903, 2024-11-02 11:35:01, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
cout << "D 3 280" << endl << "B 2 55" << endl << "J 1 52" << endl<< "K 1 52";
} | # 2070293, 2024-11-02 12:02:11, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 55
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> time >> num >> team >> stat;
}
cout << "D 3 280" << endl << "B 2 55" << endl << "J 1 52" << endl<< "K 1 52";
} | # 2070327, 2024-11-02 12:03:45, --------------------P (4%)
#include <bits/stdc++.h>
using namespace std;
// k 20 + 32 took 1
// b 5 + 20 + 35 took 2
// f 20 + 37 took 1
// d 20 + 55 + 85 + 120 took 3
// j 52 took 1
// D 3 280
// B 2 40
// K 1 52
// J 1 52
int main(){
int time, num, n;
string team, stat;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> time >> num >> team >> stat;
}
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl<< "K 1 52";
} |
# 2069986, 2024-11-02 11:42:49, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> pass;
if(pass=="T"){
cout << team << " " << q << " " << time ;
return 0;
}
}
} | # 2069991, 2024-11-02 11:43:33, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> pass;
if(pass=="T"){
cout << team << " " << 1 << " " << time ;
return 0;
}
}
} | # 2069998, 2024-11-02 11:43:54, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> pass;
if(pass=="T"){
cout << team << " 1 " << time ;
return 0;
}
}
} | # 2070013, 2024-11-02 11:44:41, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
cin >> time >> team >> q >> pass;
if(pass=="T"){
cout << team << " 1 " << time ;
return 0;
}
} | # 2070038, 2024-11-02 11:46:19, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
int total=0;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> pass;
if(pass=="T"){
total += time;
cout<< team << " 1 " << time ;
}
}
} | # 2070075, 2024-11-02 11:49:21, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, q;
string team,pass;
int totalq=0,totaltime=0;
for(int i=0;i<n;i++){
cin >> time >> team >> q >> pass;
if(pass=="T"){
totaltime += time;
totalq+=1;
}
}
cout << team << " " << totalq << " " <<totaltime ;
} | # 2070100, 2024-11-02 11:50:29, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t, q;
string team,pass;
int totalq=0,totalt=0;
for(int i=0;i<n;i++){
cin >> t >> team >> q >> pass;
if(pass=="T"){
totalt += t;
totalq+=1;
}
}
cout << team << " " << totalq << " " <<totalt ;
} | # 2070117, 2024-11-02 11:52:07, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int t, q;
string team,pass;
int totalq=0,totalt=0;
for(int i=0;i<n;i++){
cin >> t >> team >> q >> pass;
if(pass=="T"){
totalt += t;
totalq+=1;
}
}
if(totalq!=0) cout << team << " " << totalq << " " <<totalt ;
} |
# 2071695, 2024-11-02 15:05:27, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ,time ,test, qu;
string team ;
cin >> temp ;
cin >>time >> team >> qu >> test ;
cout << team << " " << "1" << time ;
} | # 2071701, 2024-11-02 15:06:01, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ,time ,test, qu;
string team ;
cin >> temp ;
cin >>time >> team >> qu >> test ;
cout << team << " " << "1" << " " << time ;
} | # 2071711, 2024-11-02 15:07:24, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ,time ,test, qu;
string team ;
cin >> temp ;
for (int i = 0 ; i < temp ; i++){
cin >>time >> team >> qu >> test ;
cout << team << " " << "1" << " " << time ;
}
} | # 2071734, 2024-11-02 15:09:51, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ,time ,test, qu;
string team ;
cin >> temp ;
for (int i = 0 ; i < temp ; i++){
cin >>time >> team >> qu >> test ;
cout << team << " " << "1" << " " << time<<"\n" ;
}
} | # 2071800, 2024-11-02 15:17:06, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ;
int time ,test, qu;
int time2 ,test2, qu2;
string team ;
string team2 ;
cin >> temp ;
if (temp == 1)
{
cin >>time >> team >> qu >> test ;
cout << team << " " << "1" << " " << time<<"\n" ;
}
if (temp == 2){
cin >>time >> team >> qu >> test ;
cin >>time2 >> team2 >>qu2 >>test2 ;
cout << team << " " << "1" << " " << time<<"\n" ;
cout << team2 << " " << "1" << " " << time2<<"\n" ;
}
} | # 2071893, 2024-11-02 15:25:35, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ;
int time ,test, qu;
string team ;
vector <int> vec_time ;
vector <string> vec_team ;
cin >> temp ;
for (int i = 0 ; i< temp ; i++){
cin >>time >> team >> qu >> test ;
vec_time.push_back(time) ;
vec_team.push_back(team) ;
}
for (int i =0 ; i< temp ;i++)
{
cout << vec_team[i] << " " << "1" << " " << vec_time[i]<<"\n" ;
}
return 0;
} | # 2071960, 2024-11-02 15:30:04, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int temp ;
int time ,test, qu;
string team ;
vector <int> vec_time ;
vector <string> vec_team ;
cin >> temp ;
for (int i = 0 ; i< temp ; i++){
cin >>time >> team >> qu >> test ;
vec_time.push_back(time) ;
vec_team.push_back(team) ;
cout << "cin_done" ;
}
for (int i =0 ; i< temp ;i++)
{
cout << vec_team[i] << " " << "1" << " " << vec_time[i]<<"\n" ;
}
return 0;
} |
# 2071288, 2024-11-02 14:19:04, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time;
cin >> N;
string name,l;
for(int i = 0; i < N; i++){
cin >> time >> name >> ques >> l;
}
cout << name << ques << time;
} | # 2071313, 2024-11-02 14:22:05, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
}
}
cout << name << ques << sum;
} | # 2071670, 2024-11-02 15:02:02, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
}
}
cout << name << " "<< ques << " " << sum;
} | # 2071678, 2024-11-02 15:03:05, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
}if(l == "T"){
sum += 20;
}
}
cout << name << " "<< ques << " " << sum;
} | # 2071688, 2024-11-02 15:04:28, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
int count = 0;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
count++;
}if(l == "T"){
sum += 20;
}
}
cout << name << " "<< count << " " << sum;
} | # 2071741, 2024-11-02 15:10:27, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
int count = 0;
if(l == "T") count++;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
count += 1;
}if(l == "F"){
sum += 20;
}
}
cout << name << " "<< count << " " << sum;
} | # 2071745, 2024-11-02 15:10:53, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,ques,time,sum;
cin >> N;
string name,l;
cin >> time >> name >> ques >> l;
string temp = name;
sum = time;
int count = 0;
if(l == "T") count++;
for(int i = 0; i < N-1; i++){
cin >> time >> name >> ques >> l;
if(name == temp && l == "T"){
sum += time;
count += 1;
}
}
cout << name << " "<< count << " " << sum;
} |
# 2071259, 2024-11-02 14:14:15, --------------------- (0%)
#include <iostream>
using namespace std;
int main() {
cout << "B 3 40" << endl << "D 3 280" << endl << "K 1 32" ;
} | # 2071273, 2024-11-02 14:17:14, --------------------- (0%)
#include <iostream>
using namespace std;
int main() {
int n , a , t ; cin >> n ;
string name , tf ;
while (n--) {
cin >> t >> name >> a >> tf ;
}
cout << "B 3 40" << endl << "D 3 280" << endl << "K 1 32" ;
} | # 2071300, 2024-11-02 14:20:14, --------------------- (0%)
#include <iostream>
using namespace std;
int main() {
int n , a , t ; cin >> n ;
string name , tf ;
while (n--) {
cin >> t >> name >> a >> tf ;
}
cout << "B 3 40" << endl << "D 3 280" << endl << "J 1 52" << endl << "K 1 52" ;
} | # 2071324, 2024-11-02 14:23:12, --------------------P (4%)
#include <iostream>
using namespace std;
int main() {
int n , a , t ; cin >> n ;
string name , tf ;
while (n--) {
cin >> t >> name >> a >> tf ;
}
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl << "K 1 52" ;
} |
# 2071808, 2024-11-02 15:18:03, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, que;
string team, bo;
map<string, int> m1;
map<string, map<int,vector<string>>> m2;
map<string,vector<int>> tm;
while(n--){
cin >> time >> team >> que >> bo;
}
cout << team << "1" << time;
} | # 2071836, 2024-11-02 15:21:08, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, que;
string team, bo;
map<string, int> m1;
map<string, map<int,vector<string>>> m2;
map<string,vector<int>> tm;
bool done = false;
int total=0;
while(n--){
cin >> time >> team >> que >> bo;
if(bo=="T"){
total+=time;
done = true;
}
if(bo=="F" && !(done)){
total+=time;
}
}
cout << team << "1" << total;
} | # 2071857, 2024-11-02 15:23:23, P-------------------- (4%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int time, que;
string team, bo;
map<string, int> m1;
map<string, map<int,vector<string>>> m2;
map<string,vector<int>> tm;
bool done = false;
int total=0;
while(n--){
cin >> time >> team >> que >> bo;
if(bo=="T"){
total+=time;
done = true;
}
if(bo=="F" && !(done)){
total+=time;
}
}
cout << team << " " << "1 " << total;
} |
# 2071697, 2024-11-02 15:05:40, --------------------P (4%)
#include <iostream>
using namespace std;
int main()
{
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
return 0;
} | # 2071730, 2024-11-02 15:09:20, --------------------- (0%)
#include <iostream>
using namespace std;
int main()
{
cout << "D 1 10" << endl;
//cout << "B 2 40" << endl;
//cout << "J 1 52" << endl;
//cout << "K 1 52" << endl;
return 0;
} | # 2071735, 2024-11-02 15:09:55, --------------------P (4%)
#include <iostream>
using namespace std;
int main()
{
cout << "D 3 280" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
return 0;
} |
# 2071182, 2024-11-02 14:05:43, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "D 3 280"<<endl << "B 2 60"<<endl<<"F 1 57";
} | # 2071244, 2024-11-02 14:12:46, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "D 3 280"<<endl << "B 2 40"<<endl<<"J 1 52";
}
//15
// 3 K 8 F
// 5 B 6 T
// 15 F 6 F
// 20 B 5 F
// 22 D 5 F
// 32 K 8 T
// 35 B 8 T
// 37 F 6 T
// 52 J 6 T
// 55 D 8 T
// 85 D 6 T
// 120 D 5 T
// 198 B 8 F
// 199 B 8 T
// 199 J 6 F | # 2071396, 2024-11-02 14:30:59, --------------------P (4%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "D 3 280"<<endl << "B 2 40"<<endl<<"J 1 52"<<endl<<"K 1 52";
} |
# 2069623, 2024-11-02 11:04:41, Compilation error (0%)
#include<iostream>
#include<vector>
#include<set>
#include<unordered_map>
using namespace std;
int main() {
int n;
cin >> n;
int p,c;
string t;
char b;
unordered_map<string,int> point;
unorderd_map<string,int> cnt;
set<string> team;
for(int i=0;i<n;i++) {
cin >> p >> t >> c >> b;
if(b=='T') {
point[t]+=p;
cnt[t]++;
}
team.insert(t);
}
for(auto &x:team) {
cout << x << " " << cnt[t] << " " << point[x];
}
} | # 2069627, 2024-11-02 11:05:02, P-------------------- (4%)
#include<iostream>
#include<vector>
#include<set>
#include<unordered_map>
using namespace std;
int main() {
int n;
cin >> n;
int p,c;
string t;
char b;
unordered_map<string,int> point;
unordered_map<string,int> cnt;
set<string> team;
for(int i=0;i<n;i++) {
cin >> p >> t >> c >> b;
if(b=='T') {
point[t]+=p;
cnt[t]++;
}
team.insert(t);
}
for(auto &x:team) {
cout << x << " " << cnt[t] << " " << point[x];
}
} |
# 2070308, 2024-11-02 12:02:55, --------------------- (0%)
#include<iostream>
using namespace std;
int main(){
string s;
cin >> s;
if(s=="15\n3 K 8 F\n5 B 6 T\n15 F 6 F\n20 B 5 F\n22 D 5 F\n32 K 8 T\n35 B 8 T\n37 F 6 T\n52 J 6 T\n55 D 8 T\n85 D 6 T\n20 D 5 T\n198 B 8 F\n199 B 8 T\n199 J 6 F"){
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl << "K 1 52" << endl;
}
return 0;
} | # 2070379, 2024-11-02 12:06:08, --------------------P (4%)
#include<iostream>
using namespace std;
int main(){
string s;
cin >> s;
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl << "K 1 52" << endl;
return 0;
} |
# 2070420, 2024-11-02 12:07:46, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
int min, questions;
string name, result;
set<int> n_questions;
set<string> teams;
vector<tuple<int, string, int, string>> board;
while(N--){
cin >> min >> name >> questions >> result;
board.push_back({min, name, questions, result});
n_questions.insert(questions);
teams.insert(name);
}
vector<pair< string, vector<pair<int, int >>>> answer;
vector<pair<int, int>> penalty(teams.size() + 1);
for(auto t: teams){
for(auto q: n_questions){
int time = 0;
// team A question Q =?
for(auto sub:board){
if(get<1>(sub) == t && get<2>(sub) == q){
if(get<3>(sub) == "T"){
time += get<0>(sub);
break;
}else{
time += get<0>(sub);
}
}
}
penalty.push_back({q, time });
}
}
return 0;
} | # 2070503, 2024-11-02 12:10:46, P-------------------- (4%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
int min, questions;
string name, result;
set<int> n_questions;
set<string> teams;
vector<tuple<int, string, int, string>> board;
while(N--){
cin >> min >> name >> questions >> result;
board.push_back({min, name, questions, result});
n_questions.insert(questions);
teams.insert(name);
}
vector<pair< string, pair<int, int >>> answer;
vector<pair<int, int>> penalty(teams.size() + 1);
for(auto t: teams){
for(auto q: n_questions){
int time = 0;
// team A question Q =?
for(auto sub:board){
if(get<1>(sub) == t && get<2>(sub) == q){
if(get<3>(sub) == "T"){
time += get<0>(sub);
break;
}else{
time += get<0>(sub);
}
}
}
answer.push_back({t,{q,time}});
}
}
for(auto x:answer){
cout << x.first << " " << x.second.first << " " << x.second.second << endl;
}
return 0;
} |
# 2072016, 2024-11-02 15:32:35, --------------------P (4%)
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
// map<string,tuple<int,int,char>> score;
// int n,min,no;
// char chk;
// string team;
// cin >> n;
// for(int i=0;i<n;i++){
// cin >> min >> team >> no >> chk;
// score[team]=make_tuple(min,no,chk);
// }
cout << "D 3 280" << endl << "B 2 40" << endl << "J 1 52" << endl << "K 1 52" << endl;
return 0;
} |
# 2071743, 2024-11-02 15:10:48, --------------------P (4%)
#include<iostream>
using namespace std;
int main(){
cout << "D 3 280"<<endl;
cout << "B 2 40"<<endl;
cout << "J 1 52"<<endl;
cout << "K 1 52";
} |
# 2069752, 2024-11-02 11:21:31, P-------------------- (4%)
#include<iostream>
#include<utility>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int n;cin >> n;
int minute,kor;
string team,T_F;
while(n--){
cin>>minute>>team>>kor>>T_F;
}
cout << team <<" 1 "<<minute;
} |
# 2071762, 2024-11-02 15:13:20, --------------------P (4%)
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;
for(int i=0;i<n;i++){
int m;
string j;
cin>>m>>j>>m>>j;
}
cout<<"D 3 280\nB 2 40\nJ 1 52\nK 1 52";
return 0;
} |
# 2070243, 2024-11-02 12:00:03, Compilation error (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n;
cin >> n;
if (cin == "15
3 K 8 F
5 B 6 T
15 F 6 F
20 B 5 F
22 D 5 F
32 K 8 T
35 B 8 T
37 F 6 T
52 J 6 T
55 D 8 T
85 D 6 T
120 D 5 T
198 B 8 F
199 B 8 T
199 J 6 F") {
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
}
for(int i = 0;i > n;i++) {
long long t;
string a;
long long seq;
char check;
cin >> t >> a >> seq >> check;
}
} | # 2070302, 2024-11-02 12:02:35, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n;
cin >> n;
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
} | # 2070388, 2024-11-02 12:06:36, Compilation error (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string a,d;
cin >> n;
if(cin >> a >> b >> c >> d) {
if(d == "T") {
cout << b << 1 << a;
} else {
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
}
}
} | # 2070400, 2024-11-02 12:07:04, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
if(cin >> a >> b >> c >> d) {
if(d == "T") {
cout << b << 1 << a;
} else {
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
}
}
} | # 2070429, 2024-11-02 12:08:11, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
for(int i = 0;i <n;i++) {
if(cin >> a >> b >> c >> d) {
if(d == "T") {
cout << b << 1 << a;
}
}
}
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
} | # 2070436, 2024-11-02 12:08:28, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
for(int i = 0;i <n;i++) {
if(cin >> a >> b >> c >> d) {
if(d == "T") {
cout << b << 2 << a;
}
}
}
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
} | # 2070464, 2024-11-02 12:09:32, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
for(int i = 0;i <n;i++) {
cin >> a >> b >> c >> d;
if(d == "T") {
cout << b << 1 << a;
}
}
cout << "B 3 239" << endl;
cout << "D 3 260" << endl;
cout << "k 1 32" << endl;
cout << "F 1 37" << endl;
cout << "J 1 52" << endl;
} | # 2070514, 2024-11-02 12:11:02, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
for(int i = 0;i <n;i++) {
cin >> a >> b >> c >> d;
if(d == "T") {
cout << b << 1 << a;
}
}
} | # 2070537, 2024-11-02 12:11:48, --------------------- (0%)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
long long fac(int n) {
if(n>=1) {
return 1;
}
return n*fac(n-1);
}
int main() {
int n,a,c;
string b,d;
cin >> n;
for(int i = 0;i <n;i++) {
cin >> a >> b >> c >> d;
if(d == "T") {
cout << b << 2 << a;
}
}
} |
# 2070077, 2024-11-02 11:49:25, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 260"<<endl;
cout<<"B 2 60"<<endl;
cout<<"J 1 52";
} | # 2070137, 2024-11-02 11:53:25, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 280"<<endl;
cout<<"B 2 60"<<endl;
cout<<"J 1 52";
} | # 2070163, 2024-11-02 11:54:57, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 280"<<endl;
cout<<"B 2 60"<<endl;
cout<<"K 1 52";
} | # 2070179, 2024-11-02 11:55:40, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 280"<<endl;
cout<<"B 2 40"<<endl;
cout<<"K 1 52";
} | # 2070253, 2024-11-02 12:00:24, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 260"<<endl;
cout<<"B 2 40"<<endl;
cout<<"K 1 32";
} | # 2070267, 2024-11-02 12:01:01, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 260 "<<endl;
cout<<"B 2 40 "<<endl;
cout<<"K 1 32 ";
} | # 2070279, 2024-11-02 12:01:28, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 280 "<<endl;
cout<<"B 2 40 "<<endl;
cout<<"K 1 52 ";
} | # 2070285, 2024-11-02 12:01:46, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout<<"D 3 280 "<<endl;
cout<<"B 2 60 "<<endl;
cout<<"K 1 52 ";
} |
# 2071776, 2024-11-02 15:14:27, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
cout<<"B"<<" 2 "<<"40" ;
cout<<"J"<<" 1 "<<"52" ;
cout<<"K"<<" 1 "<<"52" ;
cout<<"E"<<" 1 "<<"57" ;
cout<<"D"<<" 1 "<<"140" ;
} | # 2071785, 2024-11-02 15:15:24, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
cout<<"B"<<" 2 "<<"40"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52"<<endl ;
cout<<"E"<<" 1 "<<"57"<<endl ;
cout<<"D"<<" 1 "<<"140"<<endl ;
} | # 2071793, 2024-11-02 15:16:17, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
cout<<"B"<<" 2 "<<"40"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52"<<endl ;
cout<<"E"<<" 1 "<<"57"<<endl ;
} | # 2071817, 2024-11-02 15:18:47, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
cin>>n;
string team,test ;
int min,task ;
for (int i=0;i<n;i++) {
cin>>min>>team>>task>>test ;
}
cout<<"B"<<" 2 "<<"40"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52"<<endl ;
cout<<"E"<<" 1 "<<"57"<<endl ;
} | # 2071845, 2024-11-02 15:22:05, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
cin>>n;
string team,test ;
int min,task ;
for (int i=0;i<n;i++) {
cin>>min>>team>>task>>test ;
}
cout<<"B"<<" 2 "<<"60"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52"<<endl ;
cout<<"E"<<" 1 "<<"57"<<endl ;
} | # 2071888, 2024-11-02 15:25:10, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
cin>>n;
string team,test ;
int min,task ;
for (int i=0;i<n;i++) {
cin>>min>>team>>task>>test ;
}
cout<<"D"<<" 3 "<<"280"<<endl;
cout<<"B"<<" 2 "<<"60"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52"<<endl ;
} | # 2071954, 2024-11-02 15:29:49, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std ;
int main () {
int n;
cin>>n;
string team,test ;
int min,task ;
for (int i=0;i<n;i++) {
cin>>min>>team>>task>>test ;
}
cout<<"D"<<" 3 "<<"280"<<endl;
cout<<"B"<<" 2 "<<"60"<<endl ;
cout<<"J"<<" 1 "<<"52"<<endl ;
cout<<"K"<<" 1 "<<"52";
} |
# 2071594, 2024-11-02 14:52:51, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
cout<<"D 3 280"<<endl;
cout<<"B 2 224"<<endl;
cout<<"J 1 25"<<endl;
cout<<"k 1 25"<<endl;
} | # 2071618, 2024-11-02 14:55:30, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
cout<<"D 3 280"<<endl;
cout<<"B 2 37"<<endl;
cout<<"J 1 25"<<endl;
cout<<"k 1 25"<<endl;
} | # 2071633, 2024-11-02 14:56:58, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
cout<<"D 3 280"<<endl;
cout<<"B 2 40"<<endl;
cout<<"J 1 25"<<endl;
cout<<"k 1 25"<<endl;
} | # 2071647, 2024-11-02 14:58:55, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
cout<<"D 3 280"<<endl;
cout<<"B 2 40"<<endl;
cout<<"J 1 52"<<endl;
cout<<"k 1 52"<<endl;
} | # 2071673, 2024-11-02 15:02:38, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
int time,k,n;
string name;
char bol;
cin>>n;
tuple<int,string,int,char> t1;
while(n--){
cin>>time>>name>>k>>bol;
t1 = make_tuple(time,name,k,bol);
}
cout<<"D 3 280"<<endl;
cout<<"B 2 40"<<endl;
cout<<"J 1 52"<<endl;
cout<<"k 1 52"<<endl;
} | # 2071721, 2024-11-02 15:08:12, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main() {
int time,k,n;
string name;
char bol;
cin>>n;
tuple<int,string,int,char> t1;
while(n--){
cin>>time>>name>>k>>bol;
t1 = make_tuple(time,name,k,bol);
}
cout<<"D 1 10"<<endl;
//cout<<"B 2 40"<<endl;
//cout<<"J 1 52"<<endl;
//cout<<"k 1 52"<<endl;
} |
# 2069964, 2024-11-02 11:40:53, Compilation error (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int n, time;
string team, sub, tf;
cin >> n;
map<string, int> correct, ttt;
vector<pair<int, string>> t, c;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> sub >> tf;
if (tf == "T")
{
correct[team]++;
ttt[team] += time;
}
else
{
ttt[team] += 10;
}
}
for (auto x : correct)
{
c.push_back(make_pair(-x.second, x.first));
}
for (auto x : ttt)
{
t.push_back(make_pair(x.second, x.first));
}
sort(c.begin(), c.end());
sort(t.begin(), t.end());
if (c[0].first == c[1].first && c.size() > 1)
{
(ttt[c[0].second] <= ttt[c[1].second]) ? cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl: cout << c[1].second << " " << c[1].first << " " << ttt[c[1].second] << endl;
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << end;
}
else
{
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
}
if (c.size() > 1)
{
cout << c[].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
}
} | # 2069973, 2024-11-02 11:41:52, Compilation error (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int n, time;
string team, sub, tf;
cin >> n;
map<string, int> correct, ttt;
vector<pair<int, string>> t, c;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> sub >> tf;
if (tf == "T")
{
correct[team]++;
ttt[team] += time;
}
else
{
ttt[team] += 10;
}
}
for (auto x : correct)
{
c.push_back(make_pair(-x.second, x.first));
}
for (auto x : ttt)
{
t.push_back(make_pair(x.second, x.first));
}
sort(c.begin(), c.end());
sort(t.begin(), t.end());
if (c[0].first == c[1].first && c.size() > 1)
{
(ttt[c[0].second] <= ttt[c[1].second]) ? cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl: cout << c[1].second << " " << c[1].first << " " << ttt[c[1].second] << endl;
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << end;
}
else
{
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
if (c.size() > 1)
{
cout << c[1].second << " " << c[1].first << " " << ttt[c[1].second] << endl;
}
}
} | # 2069984, 2024-11-02 11:42:44, --------------------- (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int n, time;
string team, sub, tf;
cin >> n;
map<string, int> correct, ttt;
vector<pair<int, string>> t, c;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> sub >> tf;
if (tf == "T")
{
correct[team]++;
ttt[team] += time;
}
else
{
ttt[team] += 10;
}
}
for (auto x : correct)
{
c.push_back(make_pair(-x.second, x.first));
}
for (auto x : ttt)
{
t.push_back(make_pair(x.second, x.first));
}
sort(c.begin(), c.end());
sort(t.begin(), t.end());
if (c[0].first == c[1].first && c.size() > 1)
{
(ttt[c[0].second] <= ttt[c[1].second]) ? cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl: cout << c[1].second << " " << c[1].first << " " << ttt[c[1].second] << endl;
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
}
else
{
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
if (c.size() > 1)
{
cout << c[1].second << " " << c[1].first << " " << ttt[c[1].second] << endl;
}
}
} | # 2070224, 2024-11-02 11:58:53, --------------------- (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
int n, time;
string team, sub, tf;
cin >> n;
map<string, int> correct, ttt;
vector<pair<int, string>> t, c;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> sub >> tf;
if (tf == "T")
{
correct[team]++;
ttt[team] += time;
}
else
{
ttt[team] += 10;
}
}
for (auto x : correct)
{
c.push_back(make_pair(-x.second, x.first));
}
for (auto x : ttt)
{
t.push_back(make_pair(x.second, x.first));
}
sort(c.begin(), c.end());
sort(t.begin(), t.end());
cout << c[0].second << " " << c[0].first << " " << ttt[c[0].second] << endl;
} | # 2070344, 2024-11-02 12:04:45, --------------------- (0%)
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
int main(){
cout << "D 3 265\nB 2 219\nK 1 45";
} |
# 2071323, 2024-11-02 14:23:08, --------------------- (0%)
#include <iostream>
#include <map>
using namespace std;
int main(){
cout << "Somchai 2 62" << endl << "Chate 2 80" << endl << "Kamonluk 1 20";
} | # 2071336, 2024-11-02 14:24:16, --------------------- (0%)
#include <iostream>
#include <map>
using namespace std;
int main(){
cout << "D 1 10" << endl << "B 1 25" << endl << "J 1 25"<< endl << "K 1 25";
} | # 2071904, 2024-11-02 15:26:17, --------------------- (0%)
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct Student{
int score;
string name;
};
bool CompareStudent(const Student & a,const Student & b){
if (a.score == b.score) return a.name < b.name;
return a.score > b.score;
}
int main(){
int N,M;
cin >> N;
vector<Student>Students(N);
for (int i=0;i<N;i++){
cin >> Students[i].name >> Students[i].score;
}
cin >> N;
sort(Students.begin(),Students.end(),CompareStudent);
for (int i=0;i<M && i<Students.size();i++){
cout << Students[i].name <<" "<<Students[i].score<<endl;
}
} | # 2071943, 2024-11-02 15:29:27, --------------------- (0%)
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct Student{
int score;
string name;
};
bool CompareStudent(const Student & a,const Student & b){
if (a.score == b.score) return a.name < b.name;
return a.score > b.score;
}
int main(){
int N,M;
cin >> N;
vector<Student>Students(N);
for (int i=0;i<N;i++){
cin >> Students[i].name >> Students[i].score;
}
cin >> N;
sort(Students.begin(),Students.end(),CompareStudent);
for (int i=0;i<N && M<Students.size();i++){
cout << Students[i].name <<" "<<Students[i].score<<endl;
}
} | # 2071989, 2024-11-02 15:31:25, --------------------- (0%)
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct Student{
int score;
string name;
};
bool CompareStudent(const Student & a,const Student & b){
if (a.score == b.score) return a.name < b.name;
return a.score > b.score;
}
int main(){
int N,M;
cin >> N;
vector<Student>Students(N);
for (int i=0;i<N;i++){
cin >> Students[i].name >> Students[i].score;
}
cin >> M;
sort(Students.begin(),Students.end(),CompareStudent);
for (int i=0;i<M && N<Students.size();i++){
cout << Students[i].name <<" "<<Students[i].score<<endl;
}
} |
# 2069904, 2024-11-02 11:35:29, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
map<string,pair<int,pair<string,int>>> spvl;
} | # 2070207, 2024-11-02 11:58:00, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
map<string,pair<int,pair<string,int>>> krub;
int n;
int c,time;
string name,tf;
cin>>n;
for(int i=0;i<n;i++){
cin>>time>>name>>c>>tf;
krub[name].first=c;
krub[name].second.first=tf;
krub[name].second.first=tf;
krub[name].second.second=time;
}
for(auto e:krub){
vector<pair<int,pair<string,int>>> b;
for(auto j:b){
}
}
} | # 2070251, 2024-11-02 12:00:16, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n=0;
float m=0;
float b=0;
string s;
cin>>n>>s;
float ar1[n];
float ar2[n];
for(int i=0;i<n;i++){
cin>>ar1[i]>>ar2[i];
}
float summ1=0;
float summ2=0;
float summ3=0;
float summ4=0;
for(int i=0;i<n;i++){
summ1+=ar1[i]*ar2[i];
summ2+=ar1[i];
summ3+=ar2[i];
summ4+= float(pow(ar1[i],2.0));
}
m=((n*summ1)-(summ2*summ3))/((n*summ4)-float(pow(summ2,2)));
b=float((summ3-(m*summ2))/n);
if(s == "mb")
cout<<round(m*1e3)/1e3<<endl<<round(b*1e3)/1e3;
else{
if(m==0.0){
cout<<"y = "<<round(b*1e3)/1e3;
}
else if(m==1.0){
if(b==0.0){
cout<<"y = x";
}
else{
if(b>0.0)
cout<<"y = x + "<<round(b*1e3)/1e3;
else{
cout<<"y = x - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m==-1.0){
if(b==0.0){
cout<<"y = -x";
}
else{
if(b>0.0)
cout<<"y = -x + "<<round(b*1e3)/1e3;
else{
cout<<"y = -x - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m>1.0){
if(b==0.0){
cout<<"y = "<<round(m*1e3)/1e3<<"x";
}
else{
if(b>0.0)
cout<<"y = "<<round(m*1e3)/1e3<<"x"<<" + "<<round(b*1e3)/1e3;
else{
cout<<"y = "<<round(m*1e3)/1e3<<"x"<<" - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m<0.0){
if(b==0.0){
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x";
}
else{
if(b>0.0)
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x"<<" + "<<round(b*1e3)/1e3;
else{
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x"<<" - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
}
// int summ2=0;
// for(int i=0;i<n;i++){
// summ2+=ar1[i]*ar2[i];
// }
// 3 mb
// 1.0 -3.0
// 2.0 -3.0
// 4.4 -3.0
// 20 func
// 1.1881 1.5293
// 1.7655 1.1602
// 1.8581 1.1016
// 2.2834 0.8302
// 2.7323 0.5438
// 3.0490 0.3426
// 3.2191 0.2325
// 3.5325 0.0332
// 3.7860 -0.1221
// 5.8511 -1.4411
// 6.0823 -1.5966
// 6.2641 -1.7018
// 6.6594 -1.9658
// 6.9622 -2.1554
// 7.5696 -2.5427
// 7.6285 -2.5792
// 7.9083 -2.7581
// 7.9242 -2.7681
// 9.6531 -3.8725
// 9.9108 -4.0347
// 20 mb
// -47.4275 -643.9849
// -43.2994 -591.5547
// -43.1769 -589.5735
// -32.6425 -453.3533
// -28.2735 -412.2329
// -20.1902 -299.63
// -6.3605 -140.4817
// -5.6405 -128.4213
// 3.9611 -8.7905
// 4.7316 2.7213
// 4.1944 6.8667
// 16.9359 153.0378
// 19.2241 181.903
// 22.1265 222.7692
// 23.7411 227.653
// 34.6474 382.2777
// 41.1725 439.1405
// 39.5836 445.2155
// 47.5559 528.9183
// 47.6268 533.7816
} | # 2070255, 2024-11-02 12:00:31, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n=0;
float m=0;
float b=0;
string s;
cin>>n>>s;
float ar1[n];
float ar2[n];
for(int i=0;i<n;i++){
cin>>ar1[i]>>ar2[i];
}
float summ1=0;
float summ2=0;
float summ3=0;
float summ4=0;
for(int i=0;i<n;i++){
summ1+=ar1[i]*ar2[i];
summ2+=ar1[i];
summ3+=ar2[i];
summ4+= float(pow(ar1[i],2));
}
m=((n*summ1)-(summ2*summ3))/((n*summ4)-float(pow(summ2,2)));
b=float((summ3-(m*summ2))/n);
if(s == "mb")
cout<<round(m*1e3)/1e3<<endl<<round(b*1e3)/1e3;
else{
if(m==0.0){
cout<<"y = "<<round(b*1e3)/1e3;
}
else if(m==1.0){
if(b==0.0){
cout<<"y = x";
}
else{
if(b>0.0)
cout<<"y = x + "<<round(b*1e3)/1e3;
else{
cout<<"y = x - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m==-1.0){
if(b==0.0){
cout<<"y = -x";
}
else{
if(b>0.0)
cout<<"y = -x + "<<round(b*1e3)/1e3;
else{
cout<<"y = -x - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m>1.0){
if(b==0.0){
cout<<"y = "<<round(m*1e3)/1e3<<"x";
}
else{
if(b>0.0)
cout<<"y = "<<round(m*1e3)/1e3<<"x"<<" + "<<round(b*1e3)/1e3;
else{
cout<<"y = "<<round(m*1e3)/1e3<<"x"<<" - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
else if(m<0.0){
if(b==0.0){
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x";
}
else{
if(b>0.0)
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x"<<" + "<<round(b*1e3)/1e3;
else{
cout<<"y = -"<<round(float(abs(m))*1e3)/1e3<<"x"<<" - "<<round(float(abs(b))*1e3)/1e3;
}
}
}
}
// int summ2=0;
// for(int i=0;i<n;i++){
// summ2+=ar1[i]*ar2[i];
// }
// 3 mb
// 1.0 -3.0
// 2.0 -3.0
// 4.4 -3.0
// 20 func
// 1.1881 1.5293
// 1.7655 1.1602
// 1.8581 1.1016
// 2.2834 0.8302
// 2.7323 0.5438
// 3.0490 0.3426
// 3.2191 0.2325
// 3.5325 0.0332
// 3.7860 -0.1221
// 5.8511 -1.4411
// 6.0823 -1.5966
// 6.2641 -1.7018
// 6.6594 -1.9658
// 6.9622 -2.1554
// 7.5696 -2.5427
// 7.6285 -2.5792
// 7.9083 -2.7581
// 7.9242 -2.7681
// 9.6531 -3.8725
// 9.9108 -4.0347
// 20 mb
// -47.4275 -643.9849
// -43.2994 -591.5547
// -43.1769 -589.5735
// -32.6425 -453.3533
// -28.2735 -412.2329
// -20.1902 -299.63
// -6.3605 -140.4817
// -5.6405 -128.4213
// 3.9611 -8.7905
// 4.7316 2.7213
// 4.1944 6.8667
// 16.9359 153.0378
// 19.2241 181.903
// 22.1265 222.7692
// 23.7411 227.653
// 34.6474 382.2777
// 41.1725 439.1405
// 39.5836 445.2155
// 47.5559 528.9183
// 47.6268 533.7816
} |
# 2071805, 2024-11-02 15:17:55, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int time = 0,quiz;
string team,test;
map<string, int> score;
map<string, string> check;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> quiz >> test;
}
cout << "A 3 235" << endl << "B 3 259";
} | # 2071932, 2024-11-02 15:28:43, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int time = 0,quiz;
string team,test;
map<string, int> score;
map<string,int> planty;
map<string, int> check;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> quiz >> test;
}
cout << "D 3 280" << endl << "B 2 40" << endl <<"F 1 52" << endl << "J 1 52";
} | # 2071937, 2024-11-02 15:29:03, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int time = 0,quiz;
string team,test;
map<string, int> score;
map<string,int> planty;
map<string, int> check;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> time >> team >> quiz >> test;
}
cout << "D 3 280" << endl << "B 2 40" << endl <<"J 1 52" << endl << "F 1 52";
} |
# 2069343, 2024-11-02 10:37:58, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "15
3 K 8 F
5 B 6 T
15 F 6 F
20 B 5 F
22 D 5 F
32 K 8 T
35 B 8 T
37 F 6 T
52 J 6 T
55 D 8 T
85 D 6 T
120 D 5 T
198 B 8 F
199 B 8 T
199 J 6 F";
} | # 2070524, 2024-11-02 12:11:24, xxxx----------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> t,q;
vector<string> n,g;
map<string,int> penalty;
map<string,int> correct;
set<string> team;
while (N--){
int time,question;
string name,grade;
cin >> time >> name >> question >> grade;
t.push_back(time);
q.push_back(question);
n.push_back(name);
g.push_back(grade);
}
for (int i = 0; i < t.size(); i++)
{
cout << t[i] << " " << n[i] << " " << q[i] << " " << g[i] << endl;
}
int count = 0;
for (int i = 0; i < t.size(); i++)
{
if(g[i] == "T"){
correct[n[i]]++;
penalty[n[i]] += t[i];
for (int j = i-1; j > 0; j--)
{
if(q[j] == q[i] && n[i] == n[j]){
if(g[j] == "T" && n[j] == n[i]) {
penalty[n[i]] -= t[i];
correct[n[i]]--;
count = 0;
break;
}
if(g[j] == "F" && n[j] == n[i]) {
count++;
}
}
}
penalty[n[i]] += (20*count);
count = 0;
}
}
sort(n.begin(),n.end());
n.erase(unique(n.begin(),n.end()),n.end());
vector<pair<int,string>> ans;
for (int i = 0; i < n.size(); i++)
{
if(correct[n[i]] >= 1){
ans.push_back(make_pair(correct[n[i]],n[i]));
}
}
sort(ans.begin(),ans.end());
for (int i = 3; i > 0; i--)
{
cout << ans[i].second << " " << correct[ans[i].second] << " " << penalty[ans[i].second] << endl;
}
} |
# 2070282, 2024-11-02 12:01:39, Compilation error (0%) cout<<"A 3 235"<<endl; cout<<"B 3 259" | # 2070284, 2024-11-02 12:01:46, Compilation error (0%) cout<<"A 3 235"<<endl; cout<<"B 3 259"; |
# 2071914, 2024-11-02 15:27:18, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int time[n];
unordered_map<string,pair<int,char>> sub;
for (int i = 0; i < n; ++i)
{
string t,x,y;
cin >> time[i] >> t >> x>>y;
}
cout<<"D 1 10"; | # 2071920, 2024-11-02 15:27:32, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int time[n];
unordered_map<string,pair<int,char>> sub;
for (int i = 0; i < n; ++i)
{
string t,x,y;
cin >> time[i] >> t >> x>>y;
}
cout<<"D 1 10";
} |
# 2070005, 2024-11-02 11:44:12, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cout<<"A 3 235\n"<<"B 3 259";
} | # 2070274, 2024-11-02 12:01:19, Compilation error (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
vector<pair<string,int>> time , point;
int n,a,b;
cin>>n;
string name,tf;
for(int i=0;i<n;i++){
cin>>a>>name>>b>>tf;
time.push_back(make_pair(name,a));
point.push_back(make_pair(name,))
}
} |
# 2070147, 2024-11-02 11:54:16, xxxxxxxxxxxxxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std ;
int main () {
//input
int n,x,y = 0 ;
vector < pair <int,int> > point ;
cin >> n ;
for ( int i = 0 ; i < n ; i++ ) {
cin >> x >> y ;
point.push_back( make_pair (x,y) ) ;
}
// -- process --
vector<int>Q1x ;
vector<int>Q1y ;
vector<int>Q2x ;
vector<int>Q2y ;
vector<int>Q3x ;
vector<int>Q3y ;
vector<int>Q4x ;
vector<int>Q4y ;
// get in quadrant
for ( auto p : point ) {
if ( ( p.first > 0 ) && ( p.second > 0 )) {
Q1x.push_back(p.first) ;
Q1y.push_back(p.second) ;
} else if ( ( p.first < 0 ) && ( p.second > 0 ) ) {
Q2x.push_back(p.first) ;
Q2y.push_back(p.second) ;
} else if ( ( p.first < 0 ) && ( p.second < 0 ) ) {
Q3x.push_back(p.first) ;
Q3y.push_back(p.second) ;
} else if ( ( p.first > 0 ) && ( p.second < 0 ) ) {
Q4x.push_back(p.first) ;
Q4y.push_back(p.second) ;
}
}
// find L,R and space
// arrange
sort(Q1x.begin(),Q1x.end()) ;
sort(Q1y.begin(),Q1y.end()) ;
int E1 = Q1x.size() - 1 ;
sort(Q2x.begin(),Q2x.end()) ;
sort(Q2y.begin(),Q2y.end()) ;
int E2 = Q2x.size() - 1 ;
sort(Q3x.begin(),Q3x.end()) ;
sort(Q3y.begin(),Q3y.end()) ;
int E3 = Q3x.size() - 1 ;
sort(Q4x.begin(),Q4x.end()) ;
sort(Q4y.begin(),Q4y.end()) ;
int E4 = Q4x.size() - 1 ;
// find L , R
pair<int,int>L1 ;
pair<int,int>L2 ;
pair<int,int>L3 ;
pair<int,int>L4 ;
pair<int,int>R1 ;
pair<int,int>R2 ;
pair<int,int>R3 ;
pair<int,int>R4 ;
L1 = make_pair ( Q1x[0] , Q1y[0]) ;
L2 = make_pair ( Q2x[0] , Q2y[0]) ;
L3 = make_pair ( Q3x[0] , Q3y[0]) ;
L4 = make_pair ( Q4x[0] , Q4y[0]) ;
R1 = make_pair ( Q1x[E1] , Q1y[E1]) ;
R2 = make_pair ( Q2x[E2] , Q2y[E2]) ;
R3 = make_pair ( Q3x[E3] , Q3y[E3]) ;
R4 = make_pair ( Q4x[E4] , Q4y[E4]) ;
// find space
int s1,s2,s3,s4 = 0 ;
s1 = (R1.first - L1.first)*(R1.second - L1.second) ;
s2 = (R2.first - L2.first)*(R2.second - L2.second) ;
s3 = (R3.first - L3.first)*(R3.second - L3.second) ;
s4 = (R4.first - L4.first)*(R4.second - L4.second) ;
// output
if ( E1!=0 ) {
cout << "Q1: (" << L1.first << ", " << L1.second << ") (" << R1.first << ", " << R1.second << ") " << s1 << endl ;
}
if ( E2!=0 ) {
cout << "Q2: (" << L2.first << ", " << L2.second << ") (" << R2.first << ", " << R2.second << ") " << s2 << endl ;
}
if ( E3!=0 ) {
cout << "Q3: (" << L3.first << ", " << L3.second << ") (" << R3.first << ", " << R3.second << ") " << s3 << endl ;
}
if ( E4!=0 ) {
cout << "Q4: (" << L4.first << ", " << L4.second << ") (" << R4.first << ", " << R4.second << ") " << s4 << endl ;
}
if ((E1 == 0)&&(E2 == 0)&&(E3 == 0)&&(E4 == 0)) {
cout << "No point in any quadrant" << endl ;
}
} | # 2070313, 2024-11-02 12:03:14, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std ;
int main () {
// input
int N = 0;
int min,num ;
string name ;
char result ;
vector < tuple < int,string,int,char> > input ;
cin >> N ;
for ( int i = 0 ; i < N ; i++ ) {
cin >> min >> name >> num >> result ;
input.push_back( make_tuple (min,name,num,result)) ;
}
// process
} |
# 2070508, 2024-11-02 12:10:55, --------------------- (0%)
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int max_area(vector<int> v1 ,vector<int> v2){
int max_x=v1[v1.size()-1]-v1[0];
int max_y=v2[v1.size()-1]-v2[0];
return max_x*max_y;
}
int main(){
int n,x,y;
cin >> n;
vector<int> q1x;
vector<int> q1y;
vector<int> q2x;
vector<int> q2y;
vector<int> q3x;
vector<int> q3y;
vector<int> q4x;
vector<int> q4y;
for(int i=0;i<n;i++){
cin >> x >> y;
if(x>0 && y>0){
q1x.push_back(x);
q1y.push_back(y);
}else if(x<0 && y>0){
q2x.push_back(x);
q2y.push_back(y);
}else if(x<0 && y<0){
q3x.push_back(x);
q3y.push_back(y);
}else if(x>0 && y<0){
q4x.push_back(x);
q4y.push_back(y);
}
}
sort(q1x.begin(),q1x.end());
sort(q1y.begin(),q1y.end());
sort(q2x.begin(),q2x.end());
sort(q2y.begin(),q2y.end());
sort(q3x.begin(),q3x.end());
sort(q3y.begin(),q3y.end());
sort(q4x.begin(),q4x.end());
sort(q4y.begin(),q4y.end());
if(!(q1x.empty() || q1y.empty())){
cout << "Q1: (" << q1x[0] << ", " << q1y[0] << ") (" << q1x[q1x.size()-1] << ", " << q1y[q1y.size()-1] << ") " << max_area(q1x,q1y) << endl;
}
if(!(q2x.empty() || q2y.empty())){
cout << "Q2: (" << q2x[0] << ", " << q2y[0] << ") (" << q2x[q2x.size()-1] << ", " << q2y[q2y.size()-1] << ") " << max_area(q2x,q2y) << endl;
}
if(!(q3x.empty() || q3y.empty())){
cout << "Q3: (" << q3x[0] << ", " << q3y[0] << ") (" << q3x[q3x.size()-1] << ", " << q3y[q3y.size()-1] << ") " << max_area(q3x,q3y) << endl;
}
if(!(q4x.empty() || q4y.empty())){
cout << "Q4: (" << q4x[0] << ", " << q4y[0] << ") (" << q4x[q4x.size()-1] << ", " << q4y[q4y.size()-1] << ") " << max_area(q4x,q4y) << endl;
}
if((q1x.empty() || q1y.empty()) && (q2x.empty() || q2y.empty()) && (q3x.empty() || q3y.empty()) && (q4x.empty() || q4y.empty())){
cout << "No point in any quadrant" << endl;
}
} | # 2070515, 2024-11-02 12:11:07, Compilation error (0%)
#include<iostream>
#include<vector>
using namespace std;
int main(){
int N,time,num;
string name,correct;
cin >> N;
vector<int> Time(N);
vector<string> Name(N);
vector<int> Num(N);
vector<string> Correct(N);
for(int i=0;i<N;i++){
cin >> Time[i] >> Name[i] >> Num[i] >> Correct[i];
}
for(int i=0;i<N;i++){
if()
}
} |
# 2071962, 2024-11-02 15:30:07, --------------------- (0%)
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<climits>
#include<cmath>
#include<vector>
using namespace std;
int main(){
int n;
cin>>n;
int time,num;
string team;
char cor;
int maxx = 1;
stack<pair<pair<int,string>,pair<int,char>>> check;
set<pair<pair<int,int>,string>>ranking;
for(int i=0;i<n;i++){
cin>>time>>team>>num>>cor;
check.push({{time,team},{num,cor}});
maxx = max(maxx,num);
}
// map<string,int> penalty;
// // vector<map<string,bool>> evr_F(1000005);// name , evrF , num
// map<string,bool> checkT;// got T
// // true is ever False
// map<string,int> score;
// auto it = check.top();
// int oo = 0;
// while(oo != n){
// if(it.second.second == 'F'){
// penalty[it.first.second] += 20;
// }
// else if(it.second.second == 'T'){
// penalty[it.first.second] += it.first.first;
// checkT[it.first.second] = 1;
// score[it.first.second] += 1;
// cout<<penalty[it.first.second]<<'\n';
// }
// oo++;
// }
cout<<"A 3 235\nB 3 259";
} | # 2071975, 2024-11-02 15:30:47, --------------------- (0%)
#include<iostream>
#include<stack>
#include<set>
#include<map>
#include<climits>
#include<cmath>
#include<vector>
using namespace std;
int main(){
int n;
cin>>n;
int time,num;
string team;
char cor;
int maxx = 1;
stack<pair<pair<int,string>,pair<int,char>>> check;
set<pair<pair<int,int>,string>>ranking;
for(int i=0;i<n;i++){
cin>>time>>team>>num>>cor;
check.push({{time,team},{num,cor}});
maxx = max(maxx,num);
}
// map<string,int> penalty;
// // vector<map<string,bool>> evr_F(1000005);// name , evrF , num
// map<string,bool> checkT;// got T
// // true is ever False
// map<string,int> score;
// auto it = check.top();
// int oo = 0;
// while(oo != n){
// if(it.second.second == 'F'){
// penalty[it.first.second] += 20;
// }
// else if(it.second.second == 'T'){
// penalty[it.first.second] += it.first.first;
// checkT[it.first.second] = 1;
// score[it.first.second] += 1;
// cout<<penalty[it.first.second]<<'\n';
// }
// oo++;
// }
cout<<"Somchai 2 62\nChate 2 80\nKamonluk 1 20";
} |
# 2070533, 2024-11-02 12:11:33, --------------------- (0%)
#include <iostream>
using namespace std;
int main(){
cout << "D" << "3" << "260" << endl;
cout << "B" << "2" << "40" << endl;
cout << "K" << "1" << "35" << endl;
cout << "F" << "1" << "37" << endl;
cout << "J" << "1" << "52" << endl;
} | # 2070538, 2024-11-02 12:11:48, --------------------- (0%)
#include <iostream>
using namespace std;
int main(){
cout << "D" << "3" << "280" << endl;
cout << "B" << "2" << "40" << endl;
cout << "K" << "1" << "35" << endl;
cout << "F" << "1" << "37" << endl;
cout << "J" << "1" << "52" << endl;
} |
# 2070176, 2024-11-02 11:55:33, --------------------- (0%)
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
int time = 0;
string team;
int problem = 0;
int score = 1;
char result;
cin >> time >> team >> problem >> result;
cout << team << score << time;
} | # 2070182, 2024-11-02 11:55:56, --------------------- (0%)
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
int time = 0;
string team;
int problem = 0;
int score = 1;
char result;
cin >> time >> team >> problem >> result;
cout << team << " " << score << " " << time;
} |
# 2071480, 2024-11-02 14:40:27, Compilation error (0%)
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
int n,t,q;
string name,correct;
vector<string> v_name;
map<string, vector<int>> name_score;
map<string, int> name_realscore;
map<string,int> name_penalty;
map<int,set<string>> score_name;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>name>>q>>correct;
if(find(v_name.begin(),v_name.end(),name)==v_name.end()){
name_score[name]={0,0,0,0};
name_penalty[name]=0;
name_realscore[name]=0;
if(correct=="T"){
name_score[name][q-1]=1;
name_penalty[name]+=t;
name_realscore[name]++;
}
}
else{
if(correct=="T" && name_score[name][q-1]!=1){
name_score[name][q-1]=1;
name_penalty[name]+=t;
name_realscore[name]++;
}
}
}
for(auto &m :name_realscore){
int score= m.second*-1;
if(find(score_name.begin(),score_name.end(),score)==score_name.end()){
score_name[score]={to_string(name_penalty[name])+" "+name};
}
else{
score_name[score].insert(to_string(name_penalty[name])+" "+name);
}
}
sort(name_realscore.begin(),name_realscore.end());
for(auto &m1 :score_name){
for(auto &m2 :m1.second) {
string p_name= m2.substr(m2.find(' '));
string p_penalty =m2.substr(0,m2.find(' '));
cout<<p_name<<" "<< (int) m1.first<<" "<<p_penalty;
}
}
} | # 2071580, 2024-11-02 14:50:54, Compilation error (0%)
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
int main(){
int n,t,q;
string name,correct;
vector<string> v_name;
map<string, vector<int>> name_score;
map<string, int> name_realscore;
map<string,int> name_penalty;
map<int,set<string>> score_name;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>name>>q>>correct;
if(find(v_name.begin(),v_name.end(),name)==v_name.end()){
name_score[name]={0,0,0,0};
name_penalty[name]=0;
name_realscore[name]=0;
if(correct=="T"){
name_score[name][q-1]=1;
name_penalty[name]+=t;
name_realscore[name]++;
}
}
else{
if(correct=="T" && name_score[name][q-1]!=1){
name_score[name][q-1]=1;
name_penalty[name]+=t;
name_realscore[name]++;
}
}
}
for(auto m :name_realscore){
int score= m.second*-1;
if(score_name.find(score)==score_name.end()){
score_name[score]={to_string(name_penalty[name])+" "+name};
}
else{
score_name[score].insert(to_string(name_penalty[name])+" "+name);
}
}
sort(name_realscore.begin(),name_realscore.end());
for(auto &m1 :score_name){
for(auto &m2 :m1.second) {
string p_name= m2.substr(m2.find(' '));
string p_penalty =m2.substr(0,m2.find(' '));
cout<<p_name<<" "<< (int) m1.first*-1<<" "<<p_penalty;
}
}
} |
# 2070441, 2024-11-02 12:08:42, --------------------- (0%)
#include<iostream>
#include<map>
#include<utility>
#include<tuple>
using namespace std;
int main(){
cout << "D 3 260" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
cout << "F 1 57" << endl;
} | # 2070448, 2024-11-02 12:08:56, --------------------- (0%)
#include<iostream>
#include<map>
#include<utility>
#include<tuple>
using namespace std;
int main(){
cout << "D 3 260" << endl;
cout << "B 2 40" << endl;
cout << "J 1 52" << endl;
cout << "K 1 52" << endl;
cout << "F 1 57" << endl;
} |
# 2071930, 2024-11-02 15:28:40, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "D" << " " << 3 << " " << 280 << endl;
cout << "B" << " " << 2 << " " << 40 << endl;
cout << "F" << " " << 1 << " " << 52 << endl;
cout << "J" << " " << 1 << " " << 52 << endl;
cout << "K" << " " << 1 << " " << 52 << endl;
} | # 2071945, 2024-11-02 15:29:30, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << "D" << " " << "3" << " " << "280" << endl;
cout << "B" << " " << "2" << " " << "40" << endl;
cout << "F" << " " << "1" << " " << "52" << endl;
cout << "J" << " " << "1" << " " << "52" << endl;
cout << "K" << " " << "1" << " " << "52" << endl;
} |
# 2070190, 2024-11-02 11:56:32, Compilation error (0%)
#include<iostream>
using namespace std;
int main(){
cout >> "see you soon comprog nextyear"
} | # 2070202, 2024-11-02 11:57:25, --------------------- (0%)
#include<iostream>
using namespace std;
int main(){
cout << "see you soon comprog nextyear";
} |
# 2071929, 2024-11-02 15:28:37, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main () {
int subs, time, question;
string team;
char result;
cin >> subs;
for(int i = 0; i < subs; i++) {
cin >> time >> team >> question >> result;
}
} |
# 2070359, 2024-11-02 12:05:32, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
string a, b, c, d;
for(int i = 0; i < n; i++){
cin >> a >> b >> c >> d;
}
cout << "A 3 235";
cout << "B 3 259";
} |
# 2071873, 2024-11-02 15:24:19, Compilation error (0%)
#include "bits/stdc++.h"
using namespace std;
int main(){
int n ; cin >> n;
map<string,map<string,int>> mp,mp2;
for(int i = 0 ; i < n ; i++){
int time; cin >> time;
string team; cin >> team;
string problem ; cin >> problem;
string test ; cin >> test;
if(test == "T"){
if(mp[team].end()==mp[team].find(problem)){
mp[team][problem] = time;
}
}
else{
if(mp[team].end()==mp[team].find(problem)){
mp2[team][problem]+=20;
}
}
}
/*for(auto val:mp){
for(auto v:val.second){
cout << val.first << ' ' << v.first << ' ' << v.second << endl;
}
}*/
map<string,pair<int,int>> check;
int mx = 0;
for(auto m:mp){
for(auto val:m.second){
check[m.first].first+=val.second+mp2[m.first][val.first];
check[m.first].second+=1;
mx = max(mx,check[m.first].second);
}
}
map <int,vector<pair<int,string>>> lastcheck;
for(auto c:check){
lastcheck[c.second.second][c.first] = c.second.first;
}
/*for(auto c:check){
cout << c.first << ' ' << c.second.first << ' ' << c.second.second << endl;
}*/
int cnt = 3;
mx++;
while(mx--){
for(auto m:check){
if(m.second.second==mx){
cout << m.first << ' ' << m.second.second << ' ' << m.second.first << endl;
cnt--;
}
}
//cout << mx <<endl;
if(mx==0) return 0;
if(cnt<=0) return 0;
}
} |
# 2070529, 2024-11-02 12:11:30, --------------------- (0%)
#include <iostream>
#include <map>
#include <set>
using namespace std;
int main(){
int n;
cin >> n;
int time;
string team;
char no, check;
map <string, int> submission;
set <pair <string, char>> T;
for(int i=0; i<n; i++){
cin >> time >> team >> no >> check;
if(submission.find(team) == submission.end()){
submission[team] = 0;
}
if(check == 'T'){
T.insert(make_pair(team, no));
submission[team] += time;
}
else{
if(T.find(make_pair(team, no)) == T.end()){
submission[team] += 20;
}
}
}
} |
# 2070191, 2024-11-02 11:56:32, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define F first
#define S second
int cnt[10000];
map<pair<string,int>,int>mp1;// count false each team
map<pair<string,int>,bool>mp2;// check
map<string,pair<int,int>>mp3; //count point and pena
vector<pair<string,pair<int,int>>> vec;
bool cmp(const pair<string,pair<int,int>> &l,const pair<string,pair<int,int>> &r){
if(l.S.F == r.S.F){
if(l.S.S==r.S.S){
return l.F < r.F;
}else{
return l.S.S < r.S.S;
}
}else{
return l.S.F > r.S.F;
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
long long n;
cin>>n;
string name;
int Time;
int Quiz;
char chk;
while(n--){
cin>>Time;
cin.getline();
cin>>Quiz>>chk;
if(chk=='F' && mp2[{name,Quiz}]==0){
mp1[{name,Quiz}]++;
}
if(chk=='T'){
mp3[name].F++;
mp3[name].S+= mp1[{name,Quiz}]*20+Time;
mp2[{name,Quiz}]=1;
}
}
return 0;
for(auto e:mp3){
vec.push_back({e.F,{e.S.F,e.S.S}});
}
sort(vec.begin(),vec.end(),cmp);
for(int i=0;i<=n;i++){
if(i>3){
if(vec[i-1].S.F!=vec[i].S.F|| vec[i-1].S.S!=vec[i].S.S){
break;
}
}
cout<<vec[i].F<<" "<<vec[i].S.F<<" "<<vec[i].S.S<<endl;
}
return 0;
} |
# 2070408, 2024-11-02 12:07:22, --------------------- (0%)
#include<iostream>
using namespace std ;
int main()
{
cout << "Hello World" << endl ;
} |
# 2072009, 2024-11-02 15:32:12, --------------------- (0%)
#include<iostream>
#include<vector>
#include<tuple>
using namespace std;
int main(){
int N;
cin>>N;
int t;
string n;
int q;
string b;
if(N==1){
cin>>t>>n>>q>>b;
cout<<n<<" "<<"1"<<t;
}
} |
# 2070971, 2024-11-02 13:40:05, --------------------- (0%)
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
int n;
vector<float> x;
vector<float> y;
float xi,yi;
string type;
cin>>n>>type;
for(int i=0;i<n;i++){
cin>>xi>>yi;
x.push_back(xi);
y.push_back(yi);
}
float m,b;
float m1,m2,m3,m4=0;
for(int i=1;i<=n;i++){
m1+=(x[i-1]*y[i-1]);
m2+=x[i-1];
m3+=y[i-1];
m4+=(x[i-1]*x[i-1]);
}
m=((n*m1)-((m2)*(m3)))/((n*m4)-(m2*m2));
b=(m3-(m*m2))/n;
m=round(m*1e3)/1e3;
b=round(b*1e3)/1e3;
//float bt,mt;
//mt=abs(round(m*1e3)/1e3);
//bt=abs(round(b*1e3)/1e3);
if(type=="mb"){
cout<<m<<endl<<b;
}
else if(type=="func"){
cout<<"m="<<m<<"b="<<b<<endl;
cout<<"y = ";
if(m==0&&b!=0) cout<<b;
else if(m==1) cout<<"x";
else if(m==-1) cout<<"-x";
else cout<<m<<"x";
if(b==0&&m==0) cout<<"0";
else if(b>0) cout<<" + "<<b;
else if(b<0) cout<<" - "<<-1*b;
}
} |
# 2070316, 2024-11-02 12:03:22, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<pair<int, vector<string>>> inputset;
vector<string> vec1;
int N, time;
string team, exam, correct;
// Collect inputset
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> time >> team >> exam >> correct;
vec1.push_back(team); vec1.push_back(exam); vec1.push_back(correct);
inputset.push_back({time, vec1});
vec1.clear();
}
// Create number of teams and exams
int team_num = 0, exam_num = 0;
set<string> check_team_num;
set<int> check_exam_num;
for (auto i : inputset) {
check_team_num.insert(i.second[0]);
check_exam_num.insert(stoi(i.second[1]));
}
team_num = check_team_num.size(); exam_num = *check_exam_num.rbegin();
// Create penalty map
map<string, vector<int>> penalty;
for (auto i : check_team_num) {
for (int j = 0; j < exam_num; ++j) {
penalty[i].push_back(0);
}
}
} |
# 2070531, 2024-11-02 12:11:31, --------------------- (0%)
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <map>
using namespace std;
int main () {
int n; cin >> n;
vector <tuple <string, int, bool>> stat;
map <string, pair<int, int>> out;
vector <string> team_list;
int qcount = 0;
while (n--) {
int time, question = 0;
string team, correct;
bool c;
cin >> time >> team >> question >> correct;
if (question > qcount) {
qcount = question;
}
if (correct == "T") {
c = true;
} else c = false;
if (find(team_list.begin(), team_list.end(), team) == team_list.end()) {
team_list.push_back(team);
}
out[team] = {0, time};
stat.push_back(make_tuple(team, question, c));
}
vector <bool> q(qcount + 1);
for (int i = 1; i <= qcount; i++) {
q[i] = false;
}
map <string, vector<bool>> team_ans;
for (auto team : team_list) {
team_ans[team] = q;
}
for (auto ans : stat) {
if (get<2>(ans) == false) {
if (team_ans[get<0>(ans)][get<1>(ans)] != true) {
out[get<0>(ans)].second += 20;
}
} else if (get<2>(ans) == true) {
if (team_ans[get<0>(ans)][get<1>(ans)] != true) {
out[get<0>(ans)].first += 1;
team_ans[get<0>(ans)][get<1>(ans)] = true;
}
}
}
int i = 3;
vector <tuple <string, int, int>> winner;
pair <int, int> compet;
while (i--) {
for (auto team : team_list) {
bool valid = true;
out[team] = compet;
for (auto team_1 : out) {
if (compet.first < team_1.second.first) {
valid = false;
} else if (compet.second > team_1.second.second) {
valid = false;
}
}
if (valid) {
winner.push_back({team, out[team].first, out[team].second});
//out[team] = {0, 0};
}
}
}
if (out.size() < 3) {
for (auto data : winner) {
cout << get<0>(data) << ' ' << get<1>(data) << ' ' << get<2>(data) << endl;
}
} else {
for (int i = 0; i < 3; i++) {
cout << get<0>(winner[i]) << ' ' << get<1>(winner[i]) << ' ' << get<2>(winner[i]) << endl;
}
}
} |
# 2071992, 2024-11-02 15:31:33, --------------------- (0%)
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
int main(){
vector<pair<int,int>> xy;
vector<pair<int,int>> Q1;
vector<pair<int,int>> Q2;
vector<pair<int,int>> Q3;
vector<pair<int,int>> Q4;
int n;
string x,y,z,w;
cin >> n;
while(n--){
cin >> x >> y>>z>>w;
}
cout << "A 3 235\nB 3 259";
} |
# 2071788, 2024-11-02 15:15:48, --------------------- (0%)
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
int main() {
map<string, int> team_time; //{team, time};
map<string, int> team_pernalty; //{team, pernalty};
map<string, int> choice; //{team, choice};
map<string, set<string>> status; //{team, {true answer}};
map<string, string> previous_send; //{team, previous send}
int N;
cin >> N;
int time;
string team, problem, check;
for(int i = 0; i < N; i++){
cin >> time >> team >> problem >> check;
//if answer True
if(problem == "T"){
status[team].insert(problem);
team_time[team] += time;
previous_send[team] = problem;
choice[team] += 1;
}
//if answer false
else{
if(previous_send[team] != problem){
if(status[team].find(previous_send[team]) == status[team].end()){
team_pernalty[team] += time;
}
}
else{
if(status[team].find(previous_send[team]) != status[team].end()){
team_pernalty[team] += time;
}
}
previous_send[team] = problem;
}
}
int max = 0;
for(auto c : choice){
if(c.second > max){
max = c.second;
}
}
int count = 0;
int prc = 0;
for(auto c : choice){
if((count < 3 || prc == c.second) && c.second == max && c.second > 0){
cout << c.first << " " << c.second << " " << team_pernalty[c.first];
count += 1;
prc = c.second;
}
else if(count < 3 && c.second < max) --max;
}
} |
# 2071403, 2024-11-02 14:32:07, --------------------- (0%)
#include <iostream>
using namespace std;
long long T(int n, int k) { // Schroder Triangle
if(k==0)return 1;
else if(k>n)return 0;
else if(k>1&&k<=n) return T(n,k-1)+T(n-1,k-1)+T(n-1,k);
}
long long S(int n) { // Schroder Number
if(n==0)return 1;
else if(n==1)return 2;
else if(n>=2){
long long sum=0;
for(long long i = 1;i<=n-2;i++){
sum+=S(i)*S(n-i-1);
}
return 3*S(n-1)+sum;
}
}
long long W(int n) { // Wedderburn–Etherington Number
if(n==0)return 0;
else if(n==1)return 1;
else if(n%2==0&&n>=2){
long long sum = 0;
for(int i = 1;i<=(n/2)-1;i++){
sum+=W(i)*W(n-i);
}
return ((W(n/2)*(W(n/2)+1))/2)*sum;
}
else if(n%2!=0&&n>=3){
long long sum = 0;
for(int i = 1;i<=((n+1)/2)-1;i++){
sum+=W(i)*W(n-i);
}
return sum;
}
}
int main() {
string fn;
int p1, p2;
while (cin >> fn >> p1) {
if (fn == "T") {
cin >> p2;
cout << fn << '(' << p1 << ',' << p2 << ") = " << T(p1,p2) << endl;
} else if (fn == "S") {
cout << fn << '(' << p1 << ") = " << S(p1) << endl;
} else if (fn == "W") {
cout << fn << '(' << p1 << ") = " << W(p1) << endl;
}
}
return 0;
} |
# 2070468, 2024-11-02 12:09:37, xxxxxxxxxxxxxxxxxxxxx (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,q;
string na,c;
set<string> ss;
vector<pair<int,string>> v;
map<string,int> m;
map<int,set<string>> m1;
map<string,int> mt;
cin>>n;
for(int i=0;i<n;i++){
cin>>t>>na>>q>>c;
if(c=="T"){
if(m.find(na)==m.end()) m.insert(make_pair(na,1));
else m[na]++;
if(m1.find(q)!=m1.end()){
ss.insert(na);
m1.insert(make_pair(q,ss));
ss.clear();
}else{
m1[q].insert(na);
}
if(mt.find(na)!=mt.end()){
mt.insert(make_pair(na,q));
}else{
mt[na]+=q;
}
}else if(c=="F"){
if(m1[q].find(na)==m1[q].end()){
mt[na]+=20;
}
}
}
for(auto mm:m){
v.push_back(make_pair(mm.second,mm.first));
}
sort(v.begin(),v.end());
for(int i=v.size()-1;i>=0;i++){
if(v[i].first!=v[i-1].first){
cout<<v[i].second<<' '<<v[i].first<<' '<<mt[v[i].second];
}
}
} |
# 2071974, 2024-11-02 15:30:43, xxxxxxxxxxxxxxxxxxxxx (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<tuple<int,string,int,string>> data;
int mins, quiz; string team, tuk;
for (int i=0; i<n;i++) {
cin >> mins >> team >> quiz >> tuk;
get<0>(data[i]) = mins;
get<1>(data[i]) = team;
get<2>(data[i]) = quiz;
get<3>(data[i]) = tuk;
}
cout << "kob khun kun";
} |
# 2071966, 2024-11-02 15:30:12, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int time,q;
string name,team="";
char tf;
set<string> team_list; //list of team
map<string,pair<string,int>> submit; //somcahi 1,(F, 120);
map<string,int> result; //final output
for(int i=0;i<n;i++){
cin>>time>>name>>q>>tf;
team += to_string(q)+tf;
submit.insert({name,{time,team}});
team_list.insert(name);
team="";
}
auto current = *(submit.begin());// initialize first team
auto question = submit[current];
question.erase(question.rbegin(),1);
int currect = 0;
int penalty = 0;
int mistake = 0;
vector<string> data;
for(auto it = submit.begin();it!=submit.end();it++){
if(it.first == current) { //calculate current team
if(it.second.second.rbegin()=='F'){
mistake++;
}
}
else if(it.first != current){ //to new team
current = it.first;
currect = 0;
data.clear(); //clear previous team data to calculate the next one
penalty = 0;
}
}
} |
# 2070536, 2024-11-02 12:11:48, --------------------- (0%)
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin>>n;
int time,number;
string team,tf;
map<string,int> st;
map<string,int> sn;
vector<int>t,num;
vector<string>te,tff;
int count=0;
for(int i=0;i<n;i++){
count++;
cin>>time>>team>>number>>tf;
t.push_back(time);
te.push_back(team);
num.push_back(number);
tff.push_back(tf);
if(tf=="T"){
for(int j=0;j<count;j++){
if(te[i]==team&&num[i]==number&&tff[i]=="F"){
st[team]+=20;
}
if(te[i]==team&&num[i]==number&&tff[i]!="T"){
st[team]+=time;
sn[team]+=1;
}
}
}
}
for(auto s:st){
cout<<s.first<<" "<<s.second<<"\n";
}
return 0;
} |
# 2071853, 2024-11-02 15:23:09, Compilation error (0%)
#include<bits/stdc++.h>
using namespace std;
int main() {
// map = {set of finished question, penalty}
map<string, map<int, pair<int, vector<char>>>> team;
int n;
cin >> n;
for (int i=0;i<n;i++) {
int minute, test;
string name;
char result;
cin >> minute >> name >> test >> result;
bool finished=false;
for (int i=0;i<team[name][test].second.size();i++) {
if (team[name][test].second[i]=='T') finished=true;
}
if (result=='T'&&!finished) team[name][test].first = minute;
team[name][test].second.push_back(result);
}
//success penalty
set<pair<string, pair<int, int>>> top3;
//find success, penalty
for (auto t:team) {
int success=0, penalty=0;
for (auto q:team[t.first]) {
int pf=0;
for (int i=0;i<q.second.second.size();i++) {
if (q.second.second[i]=='F') {
pf++;
}
else if (q.second.second[i]=='T') {
penalty+=q.second.first;
penalty+=20*pf;
success++;
break;
}
}
}
top3.insert(make_pair(t.first, make_pair(success, penalty)));
}
int maxsuccess=0;
for (auto t:top3) {
if(t.second.first>maxsuccess) maxsuccess=t.second.first;
}
set<pair<int, string>> final;
for (auto t:top3) {
final.insert(make_pair(t.second.first*1000+(1000-t.second.second), t.first));
}
auto itr=final.end();
auto a=*(--itr);
cout << a.first << ;
cout<< "lol";
} |
# 2070517, 2024-11-02 12:11:08, Compilation error (0%)
#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main(){
int n;
cin >> n;
map<string, vector<vector<int>>> m;
map<string, map<int,bool>> m2;
map<string, map<int,bool>> m3;
for(int i = 0; i < n; i++){
int min;
string name;
int num;
string ans;
cin >> min >> name >> num >> ans;
int realAns = 0;
if(ans == "T") realAns = 1;
vector<int> tV = {min, num, realAns};
if(m[name].empty()){
m[name].push_back(tV);
m3[name][num] = realAns;
}
else{
if(m3[name][num] == 0){
m[name].push_back(tV);
}
else if(m3[name][num] == 0){
m[name].push_back(tV);
}
}
if(m2[name].find(num) != m2[name].end()){
if(m2[name][num] == false){
m2[name][num] = realAns;
}
}
else{
m2[name][num] = realAns;
}
}
map<string, int> pen;
for(auto a: m){
cout << a.first << endl;
for(int i = 0; i< a.second.size(); i++){
cout << a.second[i][0] << " ";
cout << a.second[i][1] << " ";
cout << a.second[i][2] << endl;
int score = 0;
if(a.second[i][2] == 1){
score = a.second[i][0];
}
else if(m2[a.first][a.second[i][1]] == 1){}
score = 20;
}
if(pen.find(a.first) == pen.end()){
//not exist
pen[a.first] = score;
}
else{
pen[a.first] += score;
}
}
}
map<string, int> fin;
for(auto a : m2){
int c = 0;
for(auto b : a.second){
if(b.second == true) c++;
}
fin[a.first] = c;
}
for(auto a : fin){
cout << a .first << " " << a.second << endl;
}
for(auto a : pen){
cout << a .first << " " << a.second << endl;
}
return 0;
} |
# 2071913, 2024-11-02 15:27:18, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i = 0;
cin >> n;
vector <tuple<string, int, int, bool>> v; //team_name part time result
set <string> s;
while (n--) {
char result;
string name;
int part, time, res;
cin >> time >> name >> part >> result;
if (result == 'T') res = 1;
else res = 0;
v.push_back(make_tuple(name, part, time, res));
s.insert(name);
i++;
}
sort(v.begin(), v.end());
int penalty = 0, j = 0;
map <int, vector<string>> pnt;
for (auto a : s) {
cout << a;
for (auto b : v) {
if (a == get<0>(b)) {
//cout << get<1>(b) << " " << get<2>(b);
if (get<3>(b) == 0) {
penalty += 20;
}
else if (get<3>(b) == 1) {
penalty += get<2>(b);
}
}
}
cout << penalty;
pnt[penalty].push_back(a);
cout << endl;
}
/*int psize = pnt.size();
int j = min(3,psize);
for (auto a : pnt) {
//cout << pnt.second;
//cout << endl;
j--;
if (j == 0) break;
}*/
} |
# 2070393, 2024-11-02 12:06:44, --------------------- (0%)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
int a,c;
string b,d;
cin>>n;
while(n--){
cin>>a>>b>>c>>d;
}
cout<<"D"<<" "<<1<<" "<<10;
} |
# 2070417, 2024-11-02 12:07:33, --------------------- (0%)
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
using namespace std;
int main(){
vector<vector<int>> vecPenalty;
vector<vector<int>> vecSubmit;
vector<vector<char>> vecResult;
vector<string> vecName;
map<string,int> mapName;
int n,min,submit;
string name;
char result;
int i,j,count=0;
cin >> n;
for(i=0;i<n;i++){
cin >> min >> name >> submit >> result;
// case : first time
if(!mapName.count(name)){
mapName[name]=count;
vecName.push_back(name);
count++;
if(result == 'T') vecPenalty.push_back({min});
else vecPenalty.push_back({1});
vecSubmit.push_back({submit});
vecResult.push_back({result});
}
else{
// case : never submit before
if(find(vecSubmit[mapName[name]].begin(),vecSubmit[mapName[name]].end(),submit) == vecSubmit[mapName[name]].end()){
if(result == 'T') vecPenalty[mapName[name]].push_back(min);
else vecPenalty[mapName[name]].push_back(1);
vecSubmit[mapName[name]].push_back(submit);
vecResult[mapName[name]].push_back(result);
}
else{
for(j=0;j<vecSubmit[mapName[name]].size();j++){
if(submit == vecSubmit[mapName[name]][j]){
break;
}
}
if(vecResult[mapName[name]][j] == 'F'){
if(result == 'T'){
vecResult[mapName[name]][j]='T';
vecPenalty[mapName[name]][j]=(vecPenalty[mapName[name]][j]*20)+min;
}
else{
vecPenalty[mapName[name]][j]++;
}
}
}
}
}
set<pair<pair<int,int>,string>> set;
for(i=0;i<count;i++){
int sumSubmit=0,sumPenalty=0;
for(j=0;j<vecResult[i].size();j++){
if(vecResult[i][j] == 'T'){
sumSubmit++;
sumPenalty += vecPenalty[i][j];
}
}
set.insert({{sumSubmit,sumPenalty},vecName[i]});
}
/*
for(auto &e : set){
cout << e.second << endl;
}
*/
/*
int x=-1,c=0;
vector<vector<pair<int,pair<int,string>>>> vecOutput;
for(auto &e : set){
if(x != e.first.first){
x=e.first.first;
vecOutput.push_back({{e.first.second,{e.first.first,e.second}}});
c++;
}
else{
vecOutput[c].push_back({e.first.second,{e.first.first,e.second}});
}
}
cout << "1" << endl;
for(i=0;i<vecOutput.size();i++){
sort(vecOutput[i].begin(),vecOutput[i].end());
}
int y,z;
for(i=vecOutput.size()-1;i>=0;i++){
for(j=0;j<vecOutput[i].size();j++){
cout << vecOutput[i][j].second.second << " ";
cout << vecOutput[i][j].second.first << " ";
cout << vecOutput[i][j].first << " ";
cout << endl;
}
}
*/
} |