Submission #1260437

#TimeUsernameProblemLanguageResultExecution timeMemory
1260437herominhsteveLjeto (COCI21_ljeto)C++20
25 / 50
0 ms328 KiB
#include <bits/stdc++.h>
#define el '\n'
#define FNAME "NAME"
#define allof(x) x.begin(),x.end()
#define allof1(x) x.begin()+1,x.end()
#define mset(x,n) memset(x,(n),sizeof(x))
using namespace std;
const long long MOD = (long long) 1e9+7;
template<class X,class Y> bool minimize(X &a,Y b){ if (a>b) {a=b; return true;} return false;}
template<class X,class Y> bool maximize(X &a,Y b){ if (a<b) {a=b; return true;} return false;}

void setup(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	if (fopen(FNAME".inp","r")){
		freopen(FNAME".inp","r",stdin);
		freopen(FNAME".out","w",stdout);
	}
}

struct Spray{
	int time;
	int shot,hit;
	int shotT,hitT;
	Spray(int T=0,int S=0,int H=0){
		time=T;
		shot=S;
		hit=H;
	}
};

int n;
vector<Spray> team1,team2;

void init(){
	cin>>n;
	for (int i=0;i<n;i++){
		int time,s,h;
		cin>>time>>s>>h;
		if (s<=4) team1.emplace_back(time,s,h);
		else team2.emplace_back(time,s,h);
	}
}

int calPoint(vector<Spray> &team){
	int curteam=0;
	int n =team.size();
	for (int i=0;i<n;i++){
		int curtime = team[i].time;
		curteam+=100;
		int j = i+1;
		int cnt=0;
		while (j<n and (team[j].time-curtime) <= 10 and team[j].shot==team[i].shot){
			curteam += 150;
			curtime = team[j].time;
			j++;
		}
		i = j-1;
	}
	return curteam;
}

void sol(){
	cout<<calPoint(team1)<<" "<<calPoint(team2);
}

int main(){
    setup();
    init();
    sol();
}

Compilation message (stderr)

Main.cpp: In function 'void setup()':
Main.cpp:16:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |                 freopen(FNAME".inp","r",stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:17:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |                 freopen(FNAME".out","w",stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...