Submission #2681035
Source Code Expand
/* ID: arthurc4 TASK: test LANG: C++11 */ #include <iostream> #include <fstream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <bitset> #include <random> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<vvi> vvvi; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<string> vs; typedef vector<vs> vvs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef map<string,int> msi; typedef map<int,int> mii; typedef pair<int,int> pii; typedef pair<ll,ll> pll; // note 'single' ls typedef vector<pii> vpii; typedef vector<pll> vpll; #define REP(i, a, b) \ for (int i = int(a); i <= int(b); i++) #define REPb(j, d, c) \ for (int j = int(d); j >= int(c); f--) #define pb \ push_back #define ff \ first #define ss \ second // LL OR INT ??? // DELETED IFSTREAM ??? int main() { //ifstream cin("input.txt"); //ifstream cin("test.in"); //ofstream cout("test.out"); int n, m; cin >> n >> m; vvll xyz; REP(i, 1, n) { ll x, y, z; cin >> x >> y >> z; xyz.pb({x, y, z}); } ll max_score = - pow(10, 13); for(int i=-1; i<=1; i+=2) { for(int j=-1; j<=1; j+=2) { for(int k=-1; k<=1; k+=2) { vll new_xyz; REP(a, 0, n-1) { new_xyz.pb(ll(i)*xyz[a][0] + ll(j)*xyz[a][1] + ll(k)*xyz[a][2]); } sort(new_xyz.rbegin(), new_xyz.rend()); ll score = 0; REP(b, 0, m-1) { score += new_xyz[b]; } max_score = max(max_score, score); } } } cout << max_score << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Patisserie ABC |
User | arthurconmy |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1706 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 3 ms | 256 KB |
in02.txt | AC | 3 ms | 256 KB |
in03.txt | AC | 3 ms | 256 KB |
in04.txt | AC | 3 ms | 256 KB |
in05.txt | AC | 3 ms | 256 KB |
in06.txt | AC | 3 ms | 256 KB |
in07.txt | AC | 3 ms | 256 KB |
in08.txt | AC | 2 ms | 256 KB |
in09.txt | AC | 2 ms | 256 KB |
in10.txt | AC | 2 ms | 256 KB |
in11.txt | AC | 3 ms | 256 KB |
in12.txt | AC | 3 ms | 256 KB |
in13.txt | AC | 3 ms | 256 KB |
in14.txt | AC | 3 ms | 256 KB |
in15.txt | AC | 3 ms | 256 KB |
in16.txt | AC | 3 ms | 256 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
sample_04.txt | AC | 1 ms | 256 KB |