Diff
checker
टेक्स्ट
टेक्स्ट
छवियां
दस्तावेज़
Excel
फ़ोल्डर्स
Legal
Enterprise
डेस्कटॉप
मूल्य
साइन इन करें
Diffchecker डेस्कटॉप डाउनलोड करें
टेक्स्ट की तुलना करें
दो टेक्स्ट फ़ाइलों के बीच अंतर ढूंढें
उपकरण
इतिहास
रियल-टाइम एडिटर
अपरिवर्तित संक्षिप्त करें
लाइन रैप बंद
लेआउट
विभाजित
संयुक्त
परिवर्तन हाइलाइट करें
स्मार्ट
शब्द
अक्षर
सिंटैक्स हाइलाइटिंग
सिंटैक्स चुनें
अनदेखा करें
टेक्स्ट बदलें
पहले अंतर पर जाएँ
इनपुट संपादित करें
Diffchecker Desktop
Diffchecker चलाने का सबसे सुरक्षित तरीका। Diffchecker Desktop ऐप पाएं: आपके diffs कभी आपके कंप्यूटर से बाहर नहीं जाते!
Desktop पाएं
Untitled Diff
बनाया गया
6 वर्ष पहले
Diff कभी समाप्त नहीं होता
साफ़
निर्यात करें
शेयर करें
समझाएं
3 हटाए गए
लाइनें
कुल
हटाया गया
अक्षर
कुल
हटाया गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
50 लाइनें
सभी को कॉपी करें
5 जोड़े गए
लाइनें
कुल
जोड़ा गया
अक्षर
कुल
जोड़ा गया
इस सुविधा का उपयोग जारी रखने के लिए, अपग्रेड करें
Diff
checker
Pro
मूल्य देखें
50 लाइनें
सभी को कॉपी करें
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace std;
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
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();
}
}
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
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);
कॉपी
कॉपी हुआ
कॉपी
कॉपी हुआ
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;
}
}
सेव किए गए Diffs
ऑरिजनल टेक्स्ट
फ़ाइल खोलें
#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; }
परिवर्तित टेक्स्ट
फ़ाइल खोलें
#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; }
अंतर खोजें