Submission #85376

#TimeUsernameProblemLanguageResultExecution timeMemory
85376tjdgus4384조화행렬 (KOI18_matrix)C++14
0 / 100
9 ms1148 KiB
#include<cstdio> #include<vector> #include<algorithm> using namespace std; vector<pair<int, pair<int, int> > > v; vector<int> vf; vector<int> vs; int main() { int m, n, x; scanf("%d %d",&m, &n); v.resize(n); for(int i = 0;i < m;i++) { for(int j = 0;j < n;j++) { scanf("%d", &x); if(i == 0) v[j].first = x; if(i == 1) v[j].second.first = x; if(i == 2) v[j].second.second = x; if(i == 0 && m == 2) v[j].second.second = v[j].first; } } sort(v.begin(), v.end()); vf.push_back({-1000000000}); vs.push_back({-1000000000}); for(int i = 0;i < n;i++) { int f = v[i].second.first; int s = v[i].second.second; if(f > vf.back() && s > vs.back()) { vf.push_back(f); vs.push_back(s); } else if(f < vf.back() && s < vs.back()) { int fx = lower_bound(vf.begin(), vf.end(), f) - vf.begin(); int sx = lower_bound(vs.begin(), vs.end(), s) - vs.begin(); fx = max(fx, sx); sx = fx; vf[fx] = f; vs[sx] = s; } } printf("%d", vf.size() - 1); }

Compilation message (stderr)

matrix.cpp: In function 'int main()':
matrix.cpp:47:31: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d", vf.size() - 1);
                  ~~~~~~~~~~~~~^
matrix.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&m, &n);
     ~~~~~^~~~~~~~~~~~~~~~
matrix.cpp:18:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...