Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled Diff
作成日
6 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
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;
}
}
保存された差分
原文
ファイルを開く
#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; }
違いを見つける