이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 1e6 + 5;
const int oo = 1e18, mod = 1e9 + 7;
int n, m, k, cnta=0, cntb=0, resa=0, resb=0, recent[N];
string s;
vector<iii> quer[3];
void process() {
cin >> n;
foru(i,1,n) {
int t,a,b;
cin >> t >> a >> b;
if (a<=4) quer[1].pb({{t, a}, b});
else quer[2].pb({{t, a}, b});
}
cnta=quer[1].size(); cntb=quer[2].size();
resa=cnta*100, resb=cntb*100;
foru(i,0,cnta-2) {
int fr=quer[1][i].fi.se, to=quer[1][i].se, tim=quer[1][i].fi.fi;
if (recent[to]==0) {
recent[to]=tim;
continue;
}
if (tim-recent[to]<=10) resa+=50;
recent[to]=tim;
}
foru(i,0,cntb-2) {
int fr=quer[2][i].fi.se, to=quer[2][i].se, tim=quer[2][i].fi.fi;
if (recent[to]==0) {
recent[to]=tim;
continue;
}
if (tim-recent[to]<=10) resa+=50;
recent[to]=tim;
}
cout << resa << ' ' << resb;
return;
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
//freopen(".inp", "r", stdin);
//freopen(".out", "w", stdout);
process();
cerr << "Time elapsed: " << __TIME << " s.\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'void process()':
Main.cpp:36:7: warning: unused variable 'fr' [-Wunused-variable]
36 | int fr=quer[1][i].fi.se, to=quer[1][i].se, tim=quer[1][i].fi.fi;
| ^~
Main.cpp:45:7: warning: unused variable 'fr' [-Wunused-variable]
45 | int fr=quer[2][i].fi.se, to=quer[2][i].se, tim=quer[2][i].fi.fi;
| ^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |