Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled Diff
Created
6 years ago
Diff never expires
Clear
Export
Share
Explain
3 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
50 lines
Copy
5 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
50 lines
Copy
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace std;
Copy
Copied
Copy
Copied
typedef
long long ull;
typedef
unsigned
long long ull;
struct cashier {
struct cashier {
int id, maxTime, cashierId;
int id, maxTime, cashierId;
};
};
struct comp {
struct comp {
bool operator() (cashier a, cashier b) {
bool operator() (cashier a, cashier b) {
if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId;
if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId;
return a.maxTime > b.maxTime;
return a.maxTime > b.maxTime;
}
}
};
};
bool compV(cashier a, cashier b) {
bool compV(cashier a, cashier b) {
if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId;
if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId;
return a.maxTime < b.maxTime;
return a.maxTime < b.maxTime;
}
}
int main(int argc, const char * argv[]) {
int main(int argc, const char * argv[]) {
int n, cashierNum;
int n, cashierNum;
cin >> n >> cashierNum;
cin >> n >> cashierNum;
priority_queue<cashier, vector<cashier>, comp> line;
priority_queue<cashier, vector<cashier>, comp> line;
vector<cashier> popLine;
vector<cashier> popLine;
ull ret = 0;
ull ret = 0;
for (int i=0; i<n; i++) {
for (int i=0; i<n; i++) {
int id, w;
int id, w;
cin >> id >> w;
cin >> id >> w;
if(i<cashierNum) {
if(i<cashierNum) {
line.push({id, w, i+1});
line.push({id, w, i+1});
continue;
continue;
}
}
line.push({id, w+line.top().maxTime, line.top().cashierId});
line.push({id, w+line.top().maxTime, line.top().cashierId});
popLine.push_back(line.top());
popLine.push_back(line.top());
line.pop();
line.pop();
}
}
Copy
Copied
Copy
Copied
while (
line.
size
()) {
while (
!
line.
empty
()) {
// 이 줄만 수정했습니다.
popLine.push_back(line.top());
popLine.push_back(line.top());
line.pop();
line.pop();
}
}
sort(popLine.begin(), popLine.end(), compV);
sort(popLine.begin(), popLine.end(), compV);
Copy
Copied
Copy
Copied
for (int i=0; i<
popLine.size()
; i++) {
for (int i=0; i<
n
; i++) {
ret += (ull)((i+1)*
(ull)
popLine[i].id);
ret += (ull)((i+1)*
popLine[i].id);
}
}
cout << ret << "\n";
cout << ret << "\n";
return 0;
return 0;
}
}
Saved diffs
Original text
Open file
#include <bits/stdc++.h> using namespace std; typedef long long ull; struct cashier { int id, maxTime, cashierId; }; struct comp { bool operator() (cashier a, cashier b) { if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId; return a.maxTime > b.maxTime; } }; bool compV(cashier a, cashier b) { if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId; return a.maxTime < b.maxTime; } int main(int argc, const char * argv[]) { int n, cashierNum; cin >> n >> cashierNum; priority_queue<cashier, vector<cashier>, comp> line; vector<cashier> popLine; ull ret = 0; for (int i=0; i<n; i++) { int id, w; cin >> id >> w; if(i<cashierNum) { line.push({id, w, i+1}); continue; } line.push({id, w+line.top().maxTime, line.top().cashierId}); popLine.push_back(line.top()); line.pop(); } while (line.size()) { popLine.push_back(line.top()); line.pop(); } sort(popLine.begin(), popLine.end(), compV); for (int i=0; i<popLine.size(); i++) { ret += (ull)((i+1)*(ull)popLine[i].id); } cout << ret << "\n"; return 0; }
Changed text
Open file
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; struct cashier { int id, maxTime, cashierId; }; struct comp { bool operator() (cashier a, cashier b) { if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId; return a.maxTime > b.maxTime; } }; bool compV(cashier a, cashier b) { if(a.maxTime==b.maxTime) return a.cashierId > b.cashierId; return a.maxTime < b.maxTime; } int main(int argc, const char * argv[]) { int n, cashierNum; cin >> n >> cashierNum; priority_queue<cashier, vector<cashier>, comp> line; vector<cashier> popLine; ull ret = 0; for (int i=0; i<n; i++) { int id, w; cin >> id >> w; if(i<cashierNum) { line.push({id, w, i+1}); continue; } line.push({id, w+line.top().maxTime, line.top().cashierId}); popLine.push_back(line.top()); line.pop(); } while (!line.empty()) { // 이 줄만 수정했습니다. popLine.push_back(line.top()); line.pop(); } sort(popLine.begin(), popLine.end(), compV); for (int i=0; i<n; i++) { ret += (ull)((i+1)*popLine[i].id); } cout << ret << "\n"; return 0; }
Find difference