Submission #1091501

# Submission time Handle Problem Language Result Execution time Memory
1091501 2024-09-21T03:30:35 Z quangminh412 Stove (JOI18_stove) C++14
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
using namespace std;

/*
  John Watson

  Mua Code nhu mua Florentino !!
*/

#define faster() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long

const int maxn = 5e5 + 9;

int n, m;
int t[maxn], a[maxn];

bool solve(int k)
{
	int pre = k;
	unordered_map<int, int> mp;
	int i = 1;
	while (i <= m)
	{
		if (mp[a[i]] == t[i]) pre--;
		mp[a[i]] = 1;
		i++;
		if (pre == 0) break;
	}
	if (i == m + 1) return true;
	set<int> se;
	for (auto it : mp) if (it.second != 0) se.insert(it.first);
	
	for (int j = i; j <= m; j++)
	{
		auto it1 = lower_bound(se.begin(), se.end(), a[j]);
		auto it2 = it1; it2--;
	}
}

signed main()
{
	if (fopen("test.inp", "r"))
	{
		freopen("test.inp", "r", stdin);
		freopen("test.out", "w", stdout);
	}
	faster();
	
	cin >> n >> m;
	vector<pair<int, int>> v(m);
	for (int i = 0; i < m; i++) cin >> v[i].first;
	for (int i = 0; i < m; i++) cin >> v[i].second;
	sort(v.begin(), v.end());
	for (int i = 1; i <= m; i++)
	{
		t[i] = v[i - 1].first;
		a[i] = v[i - 1].second;
	}

	return 0;
}

Compilation message

stove.cpp: In function 'bool solve(int)':
stove.cpp:21:26: warning: control reaches end of non-void function [-Wreturn-type]
   21 |  unordered_map<int, int> mp;
      |                          ^~
stove.cpp: In function 'int main()':
stove.cpp:45:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |   freopen("test.inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
stove.cpp:46:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |   freopen("test.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -